Components
Tabs
A tab list with automatic activation, line or pill styles, horizontal or vertical layout, and linked TabPanels.
Overview
Tabs renders a tab list from items. Pass TabPanels as children to link a panel to each tab by value; tabs without a panel work as a plain switcher (e.g. above a filtered list). Selection works controlled (value + onValueChange) or uncontrolled (defaultValue, falling back to the first enabled tab).
When a horizontal list is wider than its container, overflow="scroll" scrolls it with faded edges and overflow="wrap" wraps it onto more lines.
Import
import { Tabs, TabPanel } from '@unflowio/ui/components/Tabs';Props
Tabs
| Prop | Type | Default | Description |
|---|---|---|---|
items | TabItem[] | — | Required. The tabs, in order |
value | string | — | Selected tab, controlled |
defaultValue | string | first enabled tab | Initially selected tab, uncontrolled |
onValueChange | (value: string) => void | — | Called when the selection changes |
size | 'sm' | 'md' | 'md' | Tab size |
variant | 'line' | 'pill' | 'line' | line underlines the selected tab; pill fills it |
orientation | 'horizontal' | 'vertical' | 'horizontal' | Settings pages use vertical |
overflow | 'scroll' | 'wrap' | 'scroll' | What a horizontal list does when it is wider than its container |
children | ReactNode | — | TabPanels, rendered after the tab list |
TabItem:
| Field | Type | Description |
|---|---|---|
value | string | Required. Unique key, used by value / defaultValue and by TabPanel |
label | ReactNode | Required. Tab text |
count | number | string | Shown after the label, e.g. the number of items behind the tab |
icon | ReactNode | Icon before the label |
disabled | boolean | Disables the tab |
TabPanel
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Required. The value of the tab this panel belongs to |
keepMounted | boolean | — | Keeps the panel in the DOM (hidden) while another tab is selected |
Basic usage
<Tabs items={tabs} />Sizes and variants
<Tabs items={tabs} size="sm" />
<Tabs items={tabs} size="md" variant="pill" />Vertical with panels
Workspace name, default language and time zone.
<Tabs items={tabs} orientation="vertical">
<TabPanel value="general">…</TabPanel>
<TabPanel value="members">…</TabPanel>
</Tabs>Overflow
<Tabs items={tabs} overflow="scroll" />
<Tabs items={tabs} overflow="wrap" />Controlled
Selected: activity
const [value, setValue] = useState('activity');
<Tabs items={tabs} value={value} onValueChange={setValue} />Customization (slotProps)
| Slot Prop | Props | Description |
|---|---|---|
list | BaseHTMLProps<HTMLDivElement> | The tab list |
tab | BaseHTMLProps<HTMLButtonElement> | Each tab |
count | BaseHTMLProps<HTMLSpanElement> | Each tab's count |
Accessibility
- The list is a
role="tablist"witharia-orientation; each tab is arole="tab"witharia-selectedand, when a panel exists,aria-controls. - Each
TabPanelis arole="tabpanel"labelled by its tab. - Tabs activate on focus. ArrowLeft/ArrowRight (ArrowUp/ArrowDown when vertical) move the selection, skipping disabled tabs, and Home/End jump to the first/last.