Tabs
- Status
- Stable
- Accessibility
- Reviewed
- Package
tenet-ui@0.5.0- Source
- Tabs.tsx
import { Tabs } from 'tenet-ui';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 | None | Controlled active tab value. |
defaultValue | string | None | Uncontrolled initial active tab value. |
onChange | (value: string) => void | None | Called when the active tab changes. |
children | ReactNode | None | |
className | string | None |
Tabs.List
| Prop | Type | Default | Description |
|---|---|---|---|
aria-label | string | None | Accessible name for the tablist. |
children | ReactNode | None |
Tabs.Tab
| Prop | Type | Default | Description |
|---|---|---|---|
value * | string | None | Value this tab selects — must match a Tabs.Panel value. |
disabled | boolean | false | Disable this tab. |
children | ReactNode | None |
* required
Tabs.Panel
| Prop | Type | Default | Description |
|---|---|---|---|
value * | string | None | Value this panel is shown for. |
children | ReactNode | None |
* required