Tabs
Tabs organize groups of related content and let users navigate between them.
Tab API
Import
import * as Tabs from '@base_ui/react/Tabs';
const Tab = Tabs.Tab;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
value | any | You can provide your own value. Otherwise, it falls back to the child position index. |
ref
is forwarded to the root element.Theme default props
You can useTab
to change the default props of this component with the theme.TabIndicator API
Import
import * as Tabs from '@base_ui/react/Tabs';
const TabIndicator = Tabs.Indicator;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | - | A function to customize rendering of the component. |
renderBeforeHydration | bool | false | If |
ref
is forwarded to the root element.Theme default props
You can useTabIndicator
to change the default props of this component with the theme.TabPanel API
Import
import * as Tabs from '@base_ui/react/Tabs';
const TabPanel = Tabs.Panel;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
keepMounted | bool | false | If |
render | element | func | - | A function to customize rendering of the component. |
value | any | - | The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected. If not provided, it will fall back to the index of the panel. It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server. |
ref
is forwarded to the root element.Theme default props
You can useTabPanel
to change the default props of this component with the theme.TabsList API
Import
import * as Tabs from '@base_ui/react/Tabs';
const TabsList = Tabs.List;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
activateOnFocus | bool | true | If |
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
loop | bool | true | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can useTabsList
to change the default props of this component with the theme.TabsRoot API
Import
import * as Tabs from '@base_ui/react/Tabs';
const TabsRoot = Tabs.Root;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
defaultValue | any | - | The default value. Use when the component is not controlled. |
direction | 'ltr' | 'rtl' | 'ltr' | The direction of the text. |
onValueChange | func | - | Callback invoked when new value is being set. |
orientation | 'horizontal' | 'vertical' | 'horizontal' | The component orientation (layout flow direction). |
render | element | func | - | A function to customize rendering of the component. |
value | any | - | The value of the currently selected |
ref
is forwarded to the root element.Theme default props
You can useTabsRoot
to change the default props of this component with the theme.