Examples

Line

Preview

Project summary and key metrics.

Example.tsx
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.

Preview

$29 per seat, billed monthly.

Example.tsx
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.

Preview
Example.tsx
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

Tabs.Root
PropTypeDefault
value / defaultValue
Defaults 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

Tabs.List
PropTypeDefault
aria-labelrequired
Name the tab list.
string—

Tabs.Tab

Tabs.Tab
PropTypeDefault
valuerequired
string—
disabled
Skipped by arrow keys.
booleanfalse

Tabs.Panel

Tabs.Panel
PropTypeDefault
valuerequired
string—
keepMounted
booleanfalse

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.

AttributeValues
[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.

AttributeValues
[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.
Keyboard interactions
KeyAction
← / →Previous / next tab (horizontal; mirrored in RTL)
↑ / ↓Previous / next tab (vertical)
Home / EndFirst / last tab
Enter / SpaceSelect (manual activation)
TabInto 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.