Overview
Tabs organize content into multiple sections and allow users to navigate between them. Only one section is visible at a time.Features
- Full keyboard navigation
- Supports horizontal/vertical orientation
- Supports automatic/manual activation
- Can be controlled or uncontrolled
- Focus automatically managed
- Accessible by default with proper ARIA attributes
Installation
Anatomy
API Reference
Root
Contains all the tabs component parts.The controlled value of the tab to activate.
The value of the tab that should be active when initially rendered (uncontrolled).
Event handler called when the value changes.
The orientation of the tabs. Mainly affects keyboard navigation (left/right vs. up/down).
The reading direction of the tabs. If omitted, inherits from the parent.
Whether a tab is activated automatically or manually.
- automatic: Tabs are activated when receiving focus
- manual: Tabs are activated when clicked or Space/Enter is pressed
List
Contains the triggers that are aligned along the edge of the active content.When true, keyboard navigation will loop from last tab to first, and vice versa.
Change the default rendered element for the one passed as a child.
Trigger
The button that activates its associated content.A unique value that associates the trigger with content.
When true, prevents the user from interacting with the tab.
Change the default rendered element for the one passed as a child.
Content
Contains the content associated with a trigger.A unique value that associates the content with a trigger.
Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.
Change the default rendered element for the one passed as a child.
Example
Accessibility
Adheres to the Tabs WAI-ARIA design pattern.
Keyboard Interactions
- Tab - When focus moves onto the tabs, focuses the active trigger. When a trigger is focused, moves focus to the active content.
- ArrowDown - Moves focus to the next trigger (in vertical orientation) and activates its content.
- ArrowRight - Moves focus to the next trigger (in horizontal orientation) and activates its content.
- ArrowUp - Moves focus to the previous trigger (in vertical orientation) and activates its content.
- ArrowLeft - Moves focus to the previous trigger (in horizontal orientation) and activates its content.
- Home - Moves focus to the first trigger and activates its content.
- End - Moves focus to the last trigger and activates its content.