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
@marktiderman/genesis-uiimport { Tabs } from "@marktiderman/genesis-ui";@marktiderman/genesis-ui.- Tabs
- TabsList
- TabsTrigger
- TabsContent
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.
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue* | string | — | Required here even though Radix's own `defaultValue` is optional — that is the existing contract, and loosening it is a separate decision. |
| asChild | boolean | — |
TabsList
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | — |
TabsTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | — |
TabsContent
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | — |