Skip to main content
03 / Components

Tabs

Switches between related views without leaving the page. One panel visible at a time.

Preview

A short overview of the component.

Orientations

Tabs supports horizontal (default) and vertical orientations. Vertical fits dense side rails or settings panels with many sections.

horizontal
vertical

Usage

Do

Use tabs for parallel views of equivalent content — different ways to look at the same thing.

Don’t

Use tabs as primary site navigation — that belongs in the sidebar or topbar.

Do

Keep tab labels short — one or two words, scannable at a glance.

Don’t

Use tabs for sequential or step-by-step flows — use a Stepper instead.

Do

Show the active tab with a visible indicator (underline, fill, or border).

Don’t

Hide critical content behind a non-default tab without a hint that it exists.

Code

1<Tabs.Root defaultValue="overview" className="lex-tabs">
2 <Tabs.List className="lex-tabs__list">
3 <Tabs.Trigger value="overview" className="lex-tabs__trigger">Overview</Tabs.Trigger>
4 <Tabs.Trigger value="usage" className="lex-tabs__trigger">Usage</Tabs.Trigger>
5 <Tabs.Trigger value="api" className="lex-tabs__trigger">API</Tabs.Trigger>
6 </Tabs.List>
7 <Tabs.Content value="overview" className="lex-tabs__content"></Tabs.Content>
8 <Tabs.Content value="usage" className="lex-tabs__content"></Tabs.Content>
9 <Tabs.Content value="api" className="lex-tabs__content"></Tabs.Content>
10</Tabs.Root>

Design tokens

TokenUsage
--color-textActive trigger label
--color-text-2Trigger label on hover
--color-text-mutedInactive trigger label
--color-accentActive-trigger underline
--color-borderList rule
--transition-fastColour and underline transitions

Accessibility

Tabs implements the WAI-ARIA tablist pattern via Radix. The list has role="tablist"; each trigger has role="tab" and aria-selected; each panel has role="tabpanel". Provide an accessible name on the list with aria-labelif there’s no visible heading.

TabMove focus into the active tab; subsequent Tab leaves the tablist
/Move selection between triggers (horizontal orientation)
/Move selection between triggers (vertical orientation)
HomeSelect the first trigger
EndSelect the last trigger