UnflowUI
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

PropTypeDefaultDescription
itemsTabItem[]—Required. The tabs, in order
valuestring—Selected tab, controlled
defaultValuestringfirst enabled tabInitially 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
childrenReactNode—TabPanels, rendered after the tab list

TabItem:

FieldTypeDescription
valuestringRequired. Unique key, used by value / defaultValue and by TabPanel
labelReactNodeRequired. Tab text
countnumber | stringShown after the label, e.g. the number of items behind the tab
iconReactNodeIcon before the label
disabledbooleanDisables the tab

TabPanel

PropTypeDefaultDescription
valuestring—Required. The value of the tab this panel belongs to
keepMountedboolean—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 PropPropsDescription
listBaseHTMLProps<HTMLDivElement>The tab list
tabBaseHTMLProps<HTMLButtonElement>Each tab
countBaseHTMLProps<HTMLSpanElement>Each tab's count

Accessibility

  • The list is a role="tablist" with aria-orientation; each tab is a role="tab" with aria-selected and, when a panel exists, aria-controls.
  • Each TabPanel is a role="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.