Import
Basic Usage
Key Components
Tabs.Root
Groups the tabs and the corresponding panels. Renders a<div> element.
Key Props:
value:any- The value of the currently active tab (controlled)defaultValue:any- The default value for uncontrolled mode (default:0)onValueChange:(value: any, eventDetails: ChangeEventDetails) => void- Callback invoked when new value is being setorientation:'horizontal' | 'vertical'- The component orientation (default:'horizontal')
data-orientation:'horizontal' | 'vertical'- The orientation of the tabs
Tabs.List
Contains the tab buttons. Renders a<div> element.
Key Props:
loopFocus:boolean- Whether to loop keyboard focus (default:true)activateOnFocus:boolean- Whether tabs are activated automatically when receiving focus (default:true)
data-orientation: Reflects the parent orientation
Tabs.Tab
An individual interactive tab button. Renders a<button> element.
Key Props:
value:any- The value of the tab (required)disabled:boolean- Whether the tab is disabled
data-active: Present when the tab is activedata-disabled: Present when the tab is disableddata-orientation: Reflects the parent orientation
Tabs.Panel
The content panel associated with a tab. Renders a<div> element.
Key Props:
value:any- The value of the panel (required, must match a tab’s value)keepMounted:boolean- Whether to keep the panel mounted when inactive
data-active: Present when the panel is active
Tabs.Indicator
A visual indicator that highlights the active tab. Renders a<span> element.
State:
- Automatically positioned using CSS custom properties
data-activation-direction:'left' | 'right' | 'up' | 'down' | 'none'- The direction of tab activation
Features
- Automatic and manual tab activation modes
- Keyboard navigation with arrow keys
- Horizontal and vertical orientations
- Visual indicator for active tab
- Support for disabled tabs
- Controlled and uncontrolled modes
- Accessible ARIA attributes
- Loop focus option