Navigation
Tabs
Layered panels with one visible at a time — the WAI-ARIA tabs pattern with roving focus, automatic or manual activation, vertical layout and RTL support.
import { Tabs } from '@reactloom/ui';Examples
Line
import { Badge, Tabs, Text } from '@reactloom/ui';
export default function Example() {
return (
<Tabs.Root defaultValue="overview" style={{ width: '100%', maxWidth: 560 }}>
<Tabs.List aria-label="Project">
<Tabs.Tab value="overview">Overview</Tabs.Tab>
<Tabs.Tab value="activity">
Activity <Badge size="sm" tone="info">12</Badge>
</Tabs.Tab>
<Tabs.Tab value="settings">Settings</Tabs.Tab>
<Tabs.Tab value="archive" disabled>Archive</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="overview"><Text>Project summary and key metrics.</Text></Tabs.Panel>
<Tabs.Panel value="activity"><Text>12 events in the last 24 hours.</Text></Tabs.Panel>
<Tabs.Panel value="settings"><Text>Name, members and integrations.</Text></Tabs.Panel>
</Tabs.Root>
);
}Enclosed, manual activation
Arrow keys move focus; Enter or Space selects.
import { Tabs, Text } from '@reactloom/ui';
export default function Example() {
return (
<Tabs.Root defaultValue="monthly" variant="enclosed" size="sm" activationMode="manual">
<Tabs.List aria-label="Billing period">
<Tabs.Tab value="monthly">Monthly</Tabs.Tab>
<Tabs.Tab value="annual">Annual</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="monthly"><Text>$29 per seat, billed monthly.</Text></Tabs.Panel>
<Tabs.Panel value="annual"><Text>$24 per seat, billed annually.</Text></Tabs.Panel>
</Tabs.Root>
);
}Vertical
Up and down arrows; Tab moves into the panel.
import { Input, Stack, Switch, Tabs } from '@reactloom/ui';
export default function Example() {
return (
<Tabs.Root defaultValue="profile" orientation="vertical" style={{ width: '100%', maxWidth: 600 }}>
<Tabs.List aria-label="Account settings">
<Tabs.Tab value="profile">Profile</Tabs.Tab>
<Tabs.Tab value="notifications">Notifications</Tabs.Tab>
<Tabs.Tab value="security">Security</Tabs.Tab>
</Tabs.List>
<Tabs.Panel value="profile"><Input label="Display name" defaultValue="Ada" /></Tabs.Panel>
<Tabs.Panel value="notifications">
<Stack gap="2"><Switch label="Email" defaultChecked /><Switch label="Slack" /></Stack>
</Tabs.Panel>
<Tabs.Panel value="security"><Switch label="Two-factor authentication" defaultChecked /></Tabs.Panel>
</Tabs.Root>
);
}API reference
Tabs.Root
| Prop | Type | Default |
|---|---|---|
value / defaultValueDefaults to the first enabled tab. Pass defaultValue for server rendering. | string | — |
onValueChange | (value: string) => void | — |
orientation | 'horizontal' | 'vertical' | 'horizontal' |
activationMode | 'automatic' | 'manual' | 'automatic' |
variant | 'line' | 'enclosed' | 'line' |
size | 'sm' | 'md' | 'md' |
Tabs.List
| Prop | Type | Default |
|---|---|---|
aria-labelrequiredName the tab list. | string | — |
Tabs.Tab
| Prop | Type | Default |
|---|---|---|
valuerequired | string | — |
disabledSkipped by arrow keys. | boolean | false |
Tabs.Panel
| Prop | Type | Default |
|---|---|---|
valuerequired | string | — |
keepMounted | boolean | false |
Customization
Extracted from the component’s source on every build, so it matches the code. How the layers fit together is explained in Customization.
TabsRoot
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-orientation] | horizontal · vertical |
[data-size] | sm · md |
[data-variant] | line · enclosed |
Theme tokens it reads
--pl-color-accent-solid --pl-color-bg-muted --pl-color-bg-surface --pl-color-border-default --pl-color-border-input --pl-control-height-md --pl-control-height-sm --pl-font-size-sm --pl-radius-md --pl-shadow-xs
TabsTab
State attributes
Target these in your CSS to style states without depending on class names.
| Attribute | Values |
|---|---|
[data-disabled] | present when on |
[data-selected] | present when on |
Theme tokens it reads
--pl-color-accent-solid --pl-color-bg-surface --pl-color-border-input --pl-color-fg-default --pl-color-fg-disabled --pl-color-fg-muted --pl-control-height-md --pl-control-height-sm --pl-focus-ring-color --pl-focus-ring-width --pl-font-size-md --pl-font-size-sm --pl-radius-md --pl-radius-sm --pl-shadow-xs
Accessibility
- Only the selected tab is in the Tab order; arrow keys move between tabs (mirrored in RTL).
- Panels are labelled by their tab and focusable, so content without controls is reachable.
| Key | Action |
|---|---|
| ← / → | Previous / next tab (horizontal; mirrored in RTL) |
| ↑ / ↓ | Previous / next tab (vertical) |
| Home / End | First / last tab |
| Enter / Space | Select (manual activation) |
| Tab | Into the panel |
Usage guidelines
Do
- Use tabs for peer sections of the same object.
Don’t
- Don’t use tabs for sequential steps — use a Stepper (Phase 3).
- Don’t use tabs as site navigation — use links.