Overview
The Tabs component provides accessible tab navigation with keyboard arrow-key support. The active indicator slides smoothly between tabs, providing visual feedback during navigation.Import
Basic Usage
Controlled State
Default Tab
Disabled Tabs
Props
TabsProps
| Prop | Type | Default | Description |
|---|---|---|---|
tabs | TabItem[] | required | List of tabs to render |
defaultTab | string | First tab ID | Initially active tab (uncontrolled) |
activeTab | string | undefined | Controlled active tab ID |
onChange | (id: string) => void | undefined | Called with the new tab ID when selection changes |
className | string | '' | Additional CSS classes |
TabItem
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier for this tab |
label | string | Text label shown in the tab trigger |
content | ReactNode | Panel content associated with this tab |
disabled | boolean | Prevent selection of this tab |
Keyboard Navigation
The Tabs component supports full keyboard navigation:- Arrow Right: Move to next enabled tab
- Arrow Left: Move to previous enabled tab
- Tab: Focus on the tab list
- Navigation wraps around (last tab → first tab)
Accessibility
- Uses proper ARIA roles:
tablist,tab, andtabpanel - Implements
aria-selectedandaria-controlsattributes - Keyboard navigation with arrow keys
- Focus management with
tabIndex - Disabled tabs are excluded from keyboard navigation
- Active tab indicator is marked with
aria-hidden