Tabs
WAI-ARIA tabs with arrow, Home and End keys. One indicator springs between tabs, segmented or underline. Inactive panels stay in the DOM for SEO; the active one fades in.
Members
12,840Commands
48,290Clips
1,312Command usage is up 18% this week, led by /clip.
3 reports waiting for review.
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";export function SettingsTabs() { return ( <Tabs defaultValue="account" variant="underline"> <TabsList aria-label="Settings"> <TabsTrigger value="account">Account</TabsTrigger> <TabsTrigger value="password">Password</TabsTrigger> </TabsList> <TabsContent value="account">Account settings</TabsContent> <TabsContent value="password">Password settings</TabsContent> </Tabs> );}<Tabs>
WAI-ARIA tabs. Controlled (value + onValueChange) or uncontrolled (defaultValue).
defaultValuedefault""stringTab at first render (uncontrolled).
onValueChange(value: string) => voidCalled with the activated tab's value.
valuestringControlled tab; pair with
onValueChange.variantdefault"segmented""segmented" | "underline""segmented": pill in a muted track. "underline": bar under the active tab.
| Prop | Type | Default |
|---|---|---|
defaultValueTab at first render (uncontrolled). | string | "" |
onValueChangeCalled with the activated tab's value. | (value: string) => void | — |
valueControlled tab; pair with | string | — |
variant"segmented": pill in a muted track. "underline": bar under the active tab. | "segmented" | "underline" | "segmented" |
Also accepts every <div> prop.
<TabsList>
One indicator springs to the active tab, always behind the labels. Arrows, Home and End move focus.
Also accepts every <div> prop (none of its own).
<TabsTrigger>
value*stringMatches a
TabsContentvalue.
| Prop | Type | Default |
|---|---|---|
value*Matches a | string | — |
Also accepts every <button> prop.
<TabsContent>
Inactive panels stay in the DOM (hidden) so their content remains crawlable.
children*ReactNodePanel content; stays in the HTML while hidden.
value*stringMatches a
TabsTriggervalue.
| Prop | Type | Default |
|---|---|---|
children*Panel content; stays in the HTML while hidden. | ReactNode | — |
value*Matches a | string | — |
* required. Every component also takes className.