Skip to content

Tabs

A set of layered sections of content — known as tab panels — that are displayed one at a time.

  • stable
  • since v0.1.0
  • 2.6 kB
  • navigation
  • tabs
  • accessible

Uses role="tablist" / role="tab" / role="tabpanel"; keyboard navigable with arrow keys; animated indicator via TabsIndicator.

Preview
Open
tsx

Use orientation="vertical" to stack the tab list along the side.

Preview
Open
tsx

Add icons alongside tab labels by rendering icon components directly inside TabsTrigger.

Preview
Open
tsx

Pass disabled to any TabsTrigger to prevent selection.

Preview
Open
tsx
PropTypeDefaultDescription
value
string
Controlled active value.
defaultValue
string
Uncontrolled initial value.
onValueChange
((value: string) => void)
Fires with the next active value.
activationMode
"automatic"|"manual"
automatic
`automatic` activates each tab as soon as it receives keyboard focus; `manual` requires a Space/Enter press. WAI-ARIA recommends `automatic` for stable tab content, `manual` when activating a tab triggers a costly transition.
variant
"line"|"solid"|"enclosed"|"soft"
line
Visual treatment for the trigger row. `line` underlines the active tab; `solid` fills the active tab; `enclosed` draws a notched tab sitting above a panel border; `soft` uses a tinted pill.
size
"sm"|"md"|"lg"
md
Size of the trigger row.
colorScheme
"accent"|"neutral"
accent
Active-state colour. `accent` uses the theme's accent ramp; `neutral` stays in the neutral palette (useful for secondary tab strips).
orientation
"horizontal"|"vertical"
horizontal
Layout direction. Drives arrow-key navigation (←/→ for horizontal, ↑/↓ for vertical).
fullWidth
boolean
false
Make each trigger flex to fill the row evenly.
dir
"ltr"|"rtl"
Override the inherited locale direction.
  • The tab list carries role="tablist"; each trigger carries role="tab" with aria-selected and aria-controls wired by the component.
  • Arrow keys cycle between tabs within the list; Home / End jump to first / last tab.
  • TabsContent carries role="tabpanel" and is linked to its trigger via aria-labelledby.
  • TabsIndicator is aria-hidden="true" — purely decorative.
  • The disabled prop sets aria-disabled="true" on the trigger, preventing keyboard focus and interaction.
  • Use variant="solid" or variant="enclosed" for more prominent visual styling.
  • Use colorScheme="neutral" to tone down accent colour on the active trigger.
  • Use fullWidth to make all triggers share equal width.
  • Omit <TabsIndicator /> when you prefer a static active border instead of the animated underline.
  • Pair with size="sm" or size="lg" for dense or spacious UIs.