Overview
The Tabs component provides a way to organize related content into separate views that users can switch between. It features an animated indicator and supports icons, making it suitable for various navigation and content organization needs.Use cases
- Organize related content into logical sections
- Create settings panels with multiple categories
- Display different data views (e.g., table vs. chart)
- Build multi-step forms with navigation
- Show code examples in different languages
- Implement document editors with multiple tabs
Anatomy
The Tabs component consists of:Tabs- Root container that manages tab stateTabs.List- Container for tab triggers with animated indicatorTabs.Tab- Individual tab trigger buttonTabs.Content- Content panel associated with a tab
Props
Tabs (root)
Inherits all props from the Base UI Tabs.Root component.string | number
The value of the tab that should be active by default.
string | number
The controlled value of the active tab. Use with
onValueChange for controlled behavior.(value: string | number) => void
Callback fired when the active tab changes.
'horizontal' | 'vertical'
default:"'horizontal'"
The orientation of the tabs.
string
Additional CSS class names to apply to the tabs container.
Tabs.List
Inherits all props from the Base UI Tabs.List component.string
Additional CSS class names to apply to the tab list.
Tabs.Tab
string | number
required
The unique value that identifies this tab.
ReactNode
Icon to display before the tab label.
boolean
default:"false"
When true, the tab cannot be activated.
string
Additional CSS class names to apply to the tab trigger.
Tabs.Content
string | number
required
The value of the tab that this content is associated with.
string
Additional CSS class names to apply to the content panel.
Usage
Basic tabs
Tabs with icons
Controlled tabs
Disabled tabs
Code example tabs
Tabs with dynamic content
Settings panel with tabs
Accessibility
- Built on Base UI Tabs primitive with full ARIA support
- Keyboard navigation:
- Arrow keys to navigate between tabs
- Home/End keys to jump to first/last tab
- Tab key to move focus into content panel
- Automatic
role="tablist",role="tab", androle="tabpanel"attributes - Proper
aria-selectedstate on active tabs aria-controlslinks tabs to their content panelsaria-labelledbylinks content panels to their tabs- Disabled tabs are marked with
aria-disabled - Focus management follows WAI-ARIA Tabs pattern