Components
The tab system consists of four composable components:- Tabs - Root wrapper that manages tab state
- TabsList - Container for tab triggers
- TabsTrigger - Individual tab button
- TabsContent - Content panel for each tab
Basic Usage
Large Variant
Controlled Tabs
Props
Tabs
The currently active tab value. Use
bind:value for two-way bindingReference to the root element. Use
bind:ref to access the DOM nodeAdditional CSS classes to apply to the root element
Child components (TabsList and TabsContent)
TabsList
Size variant of the tabs list:
md: Medium size (height: 7, rounded-md)lg: Large size (height: 8, rounded-lg)
Reference to the list element
Additional CSS classes to apply to the list element
TabsTrigger components
TabsTrigger
Unique identifier for this tab. Must match the value in corresponding TabsContent
Size variant matching the parent TabsList:
md: Medium size (rounded)lg: Large size (rounded-md)
Reference to the trigger button element
Additional CSS classes to apply to the trigger
Content to display in the tab trigger (usually text)
TabsContent
Unique identifier for this content panel. Must match the value of corresponding TabsTrigger
Reference to the content element
Additional CSS classes to apply to the content panel
Content to display when this tab is active
Behavior
- Only one tab can be active at a time
- Active tab trigger receives
data-[state=active]attribute with elevated background and shadow - Content panels are shown/hidden based on matching
valueprop with active tab - Tab content has overflow-y-auto for scrollable content
- The component uses bits-ui’s Tabs primitive under the hood for accessibility
- Keyboard navigation is automatically supported (arrow keys, home, end)
- Focus management follows ARIA tabs pattern