Display
Tabs
Switch between views in place.
Usage
Compose Tabs, a TabsList of TabsTriggers and one TabsContent per trigger, matched by value. A single indicator glides between the triggers; the panel rises in when you switch.
Account
Make changes to your profile. Click save when you are done.
When to use
- Peer views of the same thing that you switch between often: account and password, day and week.
- Views that each fit on one screen and do not need to be compared side by side.
Not for: steps that must happen in order (use a stepper), page navigation (use links or a nav menu), long documents (use headings).
Variants
segmented (default) is a raised pill on a muted track, underline is a bar under the active tab, pills is a soft fill with no track. A disabled trigger is skipped by the arrow keys.
Unique visitors
19,306
+11.8% vs. last week
Vertical and manual activation
orientation="vertical" stacks the list and moves with Up / Down. With activationMode="manual" the arrow keys only move focus and Enter or Space opens the tab, which suits panels that are slow to render.
General
Project name, framework preset and build command. Press Enter to open a tab.
Narrow screens
When the triggers do not fit, the list scrolls sideways and the active tab is kept in view.
API
Tabs
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Controlled selected tab. |
| defaultValue | string | — | Initially selected tab when uncontrolled. |
| onValueChange | (value: string) => void | — | Called when the selected tab changes. |
| variant | 'segmented' | 'underline' | 'pills' | 'segmented' | Visual style of the list and its indicator. |
| orientation | 'horizontal' | 'vertical' | 'horizontal' | Axis of the list and of the arrow keys. |
| activationMode | 'automatic' | 'manual' | 'automatic' | Select on focus, or wait for Enter / Space. |
TabsTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Required. Matches a TabsContent. |
| disabled | boolean | — | Skipped by keyboard and clicks. |
TabsContent
| Prop | Type | Default | Description |
|---|---|---|---|
| value | string | — | Required. Shown while its trigger is selected. |
| forceMount | boolean | false | Keep the panel in the DOM, hidden, while inactive (preserves form state). |
Keyboard
| Key | Action |
|---|---|
| Tab | Moves into the list (to the selected tab), then to the open panel. |
| ← / → | Previous / next tab in a horizontal list; wraps around. |
| ↑ / ↓ | Previous / next tab in a vertical list; wraps around. |
| Home / End | First / last tab. |
| Enter / Space | Opens the focused tab (manual activation). |
Accessibility
- Follows the WAI-ARIA tabs pattern: tablist, tab with aria-selected and aria-controls, tabpanel with aria-labelledby.
- Roving tabindex: only the selected tab is in the Tab order.
- Give the list an aria-label when the purpose of the tabs is not obvious from the page.
- The indicator is decorative and hidden from assistive technology.
Motion
- The indicator glides between triggers on the morph spring (position and size), never on the first render.
- The indicator is placed after mount, so server-rendered markup does not jump: until then the active trigger is styled itself.
- The new panel rises in over 220ms; the first panel shown on load does not animate.
- Reduced motion: the indicator and panel change without movement.