<!--
  Copyright 2023 Comcast Cable Communications Management, LLC

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  SPDX-License-Identifier: Apache-2.0
-->

import { Canvas, Story } from '@storybook/addon-docs';
import { Tab } from '.';

# Tab

Tab component to be rendered in a [TabBar](/docs/components-tabbar--basic).

## Source

https://github.com/rdkcentral/Lightning-UI-Components/blob/develop/packages/@lightningjs/ui-components/src/components/TabBar/Tab.js

## Usage

`Tab` is the recommended component to use when defining `tabs` in a [TabBar](/docs/components-tabbar--basic) component.

```js
import { TabBar, Tab, Row } from '@lightningjs/ui-components';

class Example extends lng.Component {
  static _template() {
    return {
      Tab: {
        Tab: {
          type: Tab,
          icon: iconPath,
          title: 'Tab'
        }
      }
    };
  }
}
```

<Canvas>
  <Story id="components-tab--tab" />
</Canvas>

### Properties

| name       | type                                                    | required | default   | description                                                                                                     |
| ---------- | ------------------------------------------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------- |
| icon       | string                                                  | false    | undefined | path to icon to prepend tab title with                                                                          |
| title      | string                                                  | false    | undefined | text to display on tab                                                                                          |
| tabContent | <DocsLink id="lng.Component">lng.Component[]</DocsLink> | false    | undefined | tabContent accepts a component, a function which returns a component, or a promise that resolves to a component |

### Style Properties

| name            | type             | description                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| backgroundColor | string           | background color of tab                                                                                                                                                                                                                                                                                                                                                                                                                              |
| contentColor    | string           | color of icon and/or text                                                                                                                                                                                                                                                                                                                                                                                                                            |
| iconMarginRight | number           | space between icon and text                                                                                                                                                                                                                                                                                                                                                                                                                          |
| iconSize        | number           | width and height of icon                                                                                                                                                                                                                                                                                                                                                                                                                             |
| noTitlePaddingX | number           | horizontal padding of tab when only an icon is rendered                                                                                                                                                                                                                                                                                                                                                                                              |
| paddingX        | number           | horizontal padding of tab                                                                                                                                                                                                                                                                                                                                                                                                                            |
| paddingY        | number           | vertical padding of tab                                                                                                                                                                                                                                                                                                                                                                                                                              |
| radius          | number           | border radius of tab                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| textStyle       | string \| object | Style of text to be displayed. This value will take precedent over the `textStyle` style property. Available values: display1, display2, headline1, headline2, headline3, body1, body2, body3, button1, button2, callout1, caption1. Alternatively an object can be passed in containing any [properties that the Lightning text texture supports](https://lightningjs.io/docs/#/lightning-core-reference/RenderEngine/Textures/Text?id=properties). |
