Tabs
A set of layered sections of content — known as tab panels — that display one panel at a time, built on the Base UI Tabs primitive.
Installation
Bash
Usage
Examples
Line variant
With animated indicator
The indicator slides between tabs using the --active-tab-* variables. (Overview)
Composes Tabs.Indicator directly from @base-ui/react/tabs, tracking the
active tab via the --active-tab-left/--active-tab-width CSS variables.
API reference
Tabs
Extends the Base UI Tabs
Root — all its props apply. Selected-tab styling hooks on data-active
(presence); Base UI 1.7 Tabs has no data-selected and no data-state.
| Prop | Type | Default |
|---|---|---|
value / defaultValue | tab value (null deselects all) | 0 (first tab) |
onValueChange | (value, eventDetails) => void | — |
orientation | "horizontal" | "vertical" | "horizontal" |
TabsList
| Prop | Type | Default |
|---|---|---|
variant | "default" | "line" — pill or underline style | "default" |
activateOnFocus | boolean — activate on arrow-key focus | false |
loopFocus | boolean — arrow keys wrap | true |
With the default activateOnFocus: false, arrow keys move focus and
Enter/Space activates.
TabsTrigger
Renders a native <button>, but a disabled trigger stays focusable and
receives aria-disabled="true" instead of the native disabled
attribute — style disabled state with data-disabled:, not the
disabled: Tailwind variant.
| Prop | Type | Default |
|---|---|---|
value | tab value (required) | — |
disabled | boolean | false |
render | React.ReactElement — e.g. render={<a href="/account" />} | button |
nativeButton | boolean — set false when render isn’t a button | true |
TabsContent
The panel for one tab value; unselected panels are hidden.
| Prop | Type | Default |
|---|---|---|
value | tab value (required) | — |
keepMounted | boolean — keep inactive panel markup in the DOM | false |
The primitive’s animated Tabs.Indicator (tracking the active tab via
--active-tab-left/--active-tab-width CSS variables) is not wrapped —
the “animated indicator” example above composes
@base-ui/react/tabs directly inside TabsList.