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. An item can
also set icon, which renders 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 navigation#
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. The arrow keys that move focus follow the list orientation.
| 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#
Account settings owned by page state#
Keep Account, Security, and Billing on one page. Store the selected tab in local state.
Browse dashboard tabs as focus moves#
activationMode="automatic" selects Overview, Analytics, or Logs while arrow keys move focus. Use
this for lightweight inspection panels.
Confirm a settings tab with Enter#
activationMode="manual" keeps the current panel until Enter or Space. Use it when switching tabs
should be an explicit commit, as in a settings wizard.
API Reference#
Attributes#
data-disableddata-highlighteddata-selectedProps#
Props for the Tabs component. Renders a <div> element by default.