Tabs
Switch between peer panels with managed focus and activation.
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.
Basic usage#
Playground#
High-level metrics and system activity overview.
Anatomy#
String labels use the label slot; JSX labels render directly inside the trigger.
Usage#
Selected value#
Use value with onChange for controlled tabs, or defaultValue for an initial local selection. Disabled items are skipped during selection and keyboard navigation.
For JSX panel content, use an item content getter so inactive panels are not constructed before they are rendered. This is especially important in SSR and MDX, where eagerly creating an omitted component can consume hydration keys that have no matching HTML.
Activation and keyboard navigation#
activationMode="automatic" selects the tab while arrow navigation moves focus. In manual mode, arrows move focus and Enter or Space selects. loop controls whether navigation wraps at the first and last enabled items.
Keyboard interaction#
Arrow keys follow the configured orientation. activationMode="automatic" selects while moving focus; manual activation waits for Enter or Space.
| 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#
Activation mode#
Attributes#
data-disabledSlot: tabs, tabs-triggerDescription: Present when the component, slot, or item is disabled.data-highlightedSlot: tabs-triggerDescription: Present when the item is highlighted by pointer or keyboard navigation.data-selectedSlot: tabs-trigger, tabs-contentDescription: Present when the item or tab is selected.Props#
Props for the Tabs component. Renders a <div> element by default.