nori-ui

Tabs

Tab pattern with keyboard nav, roving tabindex, and shared-value content/trigger pairing.

3.5 kBgzipped

At a glance

  • Compose Tabs, TabsList, TabsTrigger, TabsContent. The value prop on each trigger pairs it with the matching content panel.
  • Controlled (value + onChange) or uncontrolled (defaultValue).
  • Keyboard nav (WAI-ARIA tablist pattern):
    • Arrow Right / Down → next tab
    • Arrow Left / Up → previous tab
    • Home / End → first / last
    • Selection follows focus by default; pass activation="manual" to require Enter / Space to activate.
  • Tabs render in their own roving tabindex group: tabbing into the list lands on the active tab, and the active tab is the only one in the tab order.

orientation

Lays the trigger list out horizontally (default) or vertically. Affects keyboard nav too: in vertical mode ArrowUp / ArrowDown move between tabs, in horizontal mode it's ArrowLeft / ArrowRight (matching the WAI-ARIA tablist convention).

<Tabs orientation="vertical" defaultValue="account">{/* … */}</Tabs>

Preview

Direction:

Props

Tabs

PropTypeDefaultDescription
activationenumautomaticWhether arrow keys also activate the focused tab. - `automatic` (default) — selection follows focus, matching most UIs. - `manual` — arrow keys move focus only; the user presses Enter or Space to activate. Use when activating a tab is expensive. @defaultValue 'automatic'
classNamestring——
defaultValuestring—Uncontrolled initial value.
onChange(next: string) => void—Fires with the new value when the active tab changes.
orientationenumhorizontalLayout direction of the tablist. Drives the keyboard-nav axis. @defaultValue 'horizontal'
testIDstring——
valuestring—Controlled active tab value.

TabsList

PropTypeDefaultDescription
classNamestring——
testIDstring——

TabsTrigger

PropTypeDefaultDescription
value*string—Value linking this trigger to a `<TabsContent>`.
classNamestring——
disabledboolean—Disable just this trigger.
testIDstring——

TabsContent

PropTypeDefaultDescription
value*string—Value of the trigger this panel pairs with.
classNamestring——
testIDstring——

On this page

Preview theme