components/Tabs
import { … } from 'zidane-ui'ui/src/components/Tabs.tsx
Components#
TabsComponent#
Renders a tab list over the selected tab's panel.
function Tabs(props: TabsProps): ElementReturns
ElementProps
| Name | Type | Default | Description |
|---|---|---|---|
| ariaLabel? | string | Accessible name of the tab list. | |
| className? | string | Extra classes on the root element. | |
| defaultValue? | string | The first selected tab. Default: the first item. | |
| items | readonly TabsItem[] | The tabs, in order. | |
| listClassName? | string | Classes on a box around the tab list (absent: no box). A surface that scrolls under its tabs makes it sticky here
( | |
| onChange? | (id: string) => void | Called with the id of the tab picked by click or keyboard. | |
| size? | 'sm' | 'md' | 'sm' | Tab height: |
| style? | CSSProperties | Inline styles on the root element. | |
| value? | string | The selected tab's id, controlled. Use it with |
Interfaces#
TabsItemInterface#
One tab of Tabs.
interface TabsItemProperties
| Name | Type | Description |
|---|---|---|
| content | ReactNode | The panel the tab shows. |
| id | string | Stable id, unique among the items. |
| label | ReactNode | The tab's label. |
TabsPropsInterface#
Props for Tabs.
interface TabsPropsProperties
| Name | Type | Default | Description |
|---|---|---|---|
| ariaLabel? | string | Accessible name of the tab list. | |
| className? | string | Extra classes on the root element. | |
| defaultValue? | string | The first selected tab. Default: the first item. | |
| items | readonly TabsItem[] | The tabs, in order. | |
| listClassName? | string | Classes on a box around the tab list (absent: no box). A surface that scrolls under its tabs makes it sticky here
( | |
| onChange? | (id: string) => void | Called with the id of the tab picked by click or keyboard. | |
| size? | 'sm' | 'md' | 'sm' | Tab height: |
| style? | CSSProperties | Inline styles on the root element. | |
| value? | string | The selected tab's id, controlled. Use it with |