Tabs
Status: stableAccessibility reviewedtenet-ui@0.4.0
import { Tabs } from 'tenet-ui';Source: src/components/Tabs/Tabs.tsx
Usage guidelines
Section titled “Usage guidelines”When to use: switching between peer views of the same context without navigating away (an entity’s Overview / Issues / Settings). For navigation between pages use links; for a small either/or use a SegmentedControl.
- Compose
Tabs.List(give it anaria-label) withTabs.Tabs, and oneTabs.Panelper tab value. Tabvaluemust match its Panelvalue. - Control it with
value+onChange, or leave uncontrolled withdefaultValue. - Keep tab labels short (one or two words). Don’t overflow a dozen tabs — that’s navigation, not tabs.
- Keyboard and ARIA are handled: arrows move (selection follows focus), Home/End jump, roles +
aria-controls/aria-labelledbyare wired. Don’t rebuild this with buttons that toggledisplay:nonedivs.
Do / Don’t
Section titled “Do / Don’t”- ✅
<Tabs defaultValue="overview"><Tabs.List aria-label="Sections">…</Tabs.List><Tabs.Panel value="overview">…</Tabs.Panel></Tabs> - ❌
<button onClick>+ conditionally rendered divs with no roles/keyboard. - ❌ Tabs as primary site navigation.
Examples
Section titled “Examples”1 story for Tabs — open in Storybook
- Default
components-tabs--default
The full matrix (all args, controls, accessibility panel) is in Storybook.
Tabs
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled active tab value. |
defaultValue | string | — | Uncontrolled initial active tab value. |
onChange | (value: string) => void | — | Called when the active tab changes. |
children | ReactNode | — | |
className | string | — |
Tabs.List
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | — | Accessible name for the tablist. |
children | ReactNode | — |
Tabs.Tab
| Prop | Type | Default | Description |
|---|---|---|---|
value * | string | — | Value this tab selects — must match a Tabs.Panel value. |
disabled | boolean | false | Disable this tab. |
children | ReactNode | — |
* required
Tabs.Panel
| Prop | Type | Default | Description |
|---|---|---|---|
value * | string | — | Value this panel is shown for. |
children | ReactNode | — |
* required