Tabs
Switch between peer panels with managed focus and activation.
High-level metrics and system activity overview.
Anatomy#
String labels use the label slot; JSX labels render directly inside the trigger.
Usage#
Use Tabs to switch between peer panels while staying in the same page context. Use navigation links when each destination needs its own URL and document state. Use Stepper for a fixed sequence. Use NavigationMenu for website destinations with expandable panels.
Selected value#
Use value with onValueChange for controlled tabs, or defaultValue for an initial local
selection. Without a matching enabled value, the first enabled tab is active. onValueChange fires
only when the user selects a different tab. Disabled items, and every tab while disabled is set,
cannot be selected; keyboard navigation skips disabled items.
Every item requires a unique value (an item that repeats an earlier value is disabled) and can
set icon to render an icon before the label.
Only the selected tab’s panel is mounted. For JSX panel content, pass a component as content: Tabs
renders it with { value } only while its tab is selected, so an unselected panel is never built.
This matters in SSR and MDX, where building a panel eagerly can emit markup the hydrated tree does
not expect.
Activation and keyboard#
activationMode="automatic" (the default) selects a tab as arrow navigation moves focus. In
manual mode, arrows move focus and Enter or Space selects.
loop (default true) wraps navigation at the first and last enabled tabs, and the arrow keys that
move focus follow the list orientation. aria-label and aria-labelledby on Tabs name the
tablist, not the root element.
| Key | Description |
|---|---|
| Arrow keys | Moves focus among enabled tabs by orientation. |
| ↖ / ↘ | Moves focus to the first or last enabled tab. |
| ↵ / Space | Activates the focused tab in manual mode. |
| ⇥ | Leaves the tab list according to normal focus order. |
Examples#
Controlled#
Control the active tab with value and onValueChange.
Manual activation#
activationMode="manual" moves focus with arrow keys and switches panels only on Enter or Space.
Use it when selecting a tab is expensive, such as a panel that fetches data.
API Reference#
Attributes#
data-disableddata-highlighteddata-selectedProps#
Props for the Tabs component. Renders a <div> element by default.