Genesis
@stable

Tabs

Top-level content switcher.

Tabs — a tablist and its panels. Backed by Radix `Tabs`. The hand-rolled version was a React context plus a row of plain `<button>`s: it tracked the selected value correctly and nothing else. Every keyboard and screen-reader affordance the WAI-ARIA tabs pattern asks for was missing — `role="tablist"`/`"tab"`/`"tabpanel"`, the `aria-selected` state, the `aria-controls`/`aria-labelledby` link between a tab and its panel, the roving `tabindex` that makes the whole tablist ONE tab stop instead of N, and Arrow/Home/End navigation between tabs. Radix supplies all of it, plus the selection state the old version already handled. One behavioural note worth knowing: Radix selects on `mousedown` rather than `click`. Pointer users see no difference, but a synthetic `fireEvent.click` on a trigger no longer changes tabs.

packages/ui/src/components/ui/tabs.tsx

Import
Subpath export: @marktiderman/genesis-ui
import { Tabs } from "@marktiderman/genesis-ui";
Exports
Re-exported from @marktiderman/genesis-ui.
  • Tabs
  • TabsList
  • TabsTrigger
  • TabsContent
Components
Auto-generated from TypeScript source via react-docgen-typescript.

Tabs

Tabs — a tablist and its panels. Backed by Radix `Tabs`. The hand-rolled version was a React context plus a row of plain `<button>`s: it tracked the selected value correctly and nothing else. Every keyboard and screen-reader affordance the WAI-ARIA tabs pattern asks for was missing — `role="tablist"`/`"tab"`/`"tabpanel"`, the `aria-selected` state, the `aria-controls`/`aria-labelledby` link between a tab and its panel, the roving `tabindex` that makes the whole tablist ONE tab stop instead of N, and Arrow/Home/End navigation between tabs. Radix supplies all of it, plus the selection state the old version already handled. One behavioural note worth knowing: Radix selects on `mousedown` rather than `click`. Pointer users see no difference, but a synthetic `fireEvent.click` on a trigger no longer changes tabs.

PropTypeDefaultDescription
defaultValue*string—Required here even though Radix's own `defaultValue` is optional — that is the existing contract, and loosening it is a separate decision.
asChildboolean—

TabsList

PropTypeDefaultDescription
asChildboolean—

TabsTrigger

PropTypeDefaultDescription
asChildboolean—

TabsContent

PropTypeDefaultDescription
asChildboolean—
Storybook
Storybook hosts the canonical visual reference with controls for every variant.