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

List

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

PropTypeDefault
activateOnFocusbooleantrue
classNamestring | (state) => stringundefined
loopbooleantrue
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

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

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
CSS VariableType
--active-tab-bottomnumber
--active-tab-heightnumber
--active-tab-leftnumber
--active-tab-rightnumber
--active-tab-topnumber
--active-tab-widthnumber

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