Skip to main content

Tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

Preview

Title

Lorem ipsum dolor sit amet consectetur. Amet venenatis id nec facilisi faucibus vivamus.

import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"
import { Input } from "@/components/ui/input"
import { Button } from "@/components/ui/button"

<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1">Item</TabsTrigger>
<TabsTrigger value="tab2">Item</TabsTrigger>
</TabsList>
<TabsContent value="tab1">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet consectetur.</p>
<Input label="Label" placeholder="Input" />
<Input label="Label" placeholder="Input" />
<Button>Confirm</Button>
</TabsContent>
<TabsContent value="tab2">
<p>Second tab content</p>
</TabsContent>
</Tabs>

Multiple Tabs

Account Settings

Manage your account details and preferences.

Disabled Tab

Active Tab

This tab is active and interactive.

<Tabs defaultValue="active">
<TabsList>
<TabsTrigger value="active">Active</TabsTrigger>
<TabsTrigger value="disabled" disabled>Disabled</TabsTrigger>
<TabsTrigger value="other">Other</TabsTrigger>
</TabsList>
<TabsContent value="active">
<p>Active tab content</p>
</TabsContent>
</Tabs>

API Reference

PropTypeDefaultDescription
defaultValuestringThe value of the tab to activate by default
valuestringControlled active tab value
onValueChange(value: string) => voidCallback when the active tab changes

TabsTrigger

PropTypeDefaultDescription
valuestringA unique value for the tab
disabledbooleanfalseWhether the tab trigger is disabled

TabsContent

PropTypeDefaultDescription
valuestringThe value that associates content with a trigger

Accessibility

  • Uses WAI-ARIA Tabs pattern with role="tablist", role="tab", and role="tabpanel"
  • Supports keyboard navigation (Arrow keys to move between tabs, Enter/Space to activate)
  • Automatic aria-selected state management
  • Focus management follows roving tabindex pattern
  • Each tab panel is associated with its trigger via aria-controls and aria-labelledby