Tabs

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

API reference

Import the component and assemble its parts:

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
defaultValue

any

0

value

any

undefined

onValueChange

(value, event) => void

undefined

orientation

'horizontal' | 'vertical'

'horizontal'

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-orientation
data-activation-direction

List

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

PropTypeDefault
activateOnFocus

boolean

true

loop

boolean

true

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-orientation
data-activation-direction

Tab

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

PropTypeDefault
value

any

undefined

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-selected
data-highlighted
data-orientation
data-disabled
data-activation-direction

Indicator

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

PropTypeDefault
renderBeforeHydration

boolean

false

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-orientation
data-activation-direction
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
value

any

undefined

className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-orientation
data-activation-direction
data-hidden