Tabs

A component for toggling between related panels on the same page.

API reference

Import the component and place its parts the following way:

Anatomy
import { Tabs } from '@base-ui-components/react/tabs';

<Tabs.Root>
  <Tabs.List>
    <Tabs.Tab />
    <Tabs.Indicator />
  </Tabs.List>
  <Tabs.Panel />
</Tabs.Root>

Root

Groups the tabs and the corresponding panels. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
defaultValueany0
onValueChange(value, event) => voidundefined
orientation'horizontal' | 'vertical''horizontal'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
valueanyundefined
Attribute
Description
data-activation-direction
data-orientation

List

Groups the individual tab buttons. Renders a <div> element.

PropTypeDefault
activateOnFocusbooleantrue
classNamestring | (state) => stringundefined
loopbooleantrue
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-activation-direction
data-orientation

Tab

An individual interactive tab button that toggles the corresponding panel. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
valueanyundefined
Attribute
Description
data-activation-direction
data-disabled
data-highlighted
data-orientation
data-selected

Indicator

A visual indicator that can be styled to match the position of the currently active tab. Renders a <span> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
renderBeforeHydrationbooleanfalse
Attribute
Description
data-activation-direction
data-orientation
CSS Variable
Description
--active-tab-bottom
--active-tab-height
--active-tab-left
--active-tab-right
--active-tab-top
--active-tab-width

Panel

A panel displayed when the corresponding tab is active. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
valueanyundefined
Attribute
Description
data-activation-direction
data-hidden
data-orientation