Installation
npx logic2b@next add tabsUsage
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
<Tabs defaultValue="account">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">Account settings.</TabsContent>
<TabsContent value="password">Password settings.</TabsContent>
</Tabs>
Examples
With icons
View your activity at a glance.
Disabled tab
Items you are currently working on.
Accessibility
- Follows the WAI-ARIA tabs pattern:
Tabmoves focus into the active trigger, thenArrowkeys move between triggers. Home/Endjump to the first / last trigger; disabled triggers are skipped.- Each
TabsContentis exposed as atabpanellabelled by its trigger, so the relationship is announced.
Live playground
Edit the component props and inspect the exact JSX before copying it. The preview loads only when this section enters the viewport.
Generated JSX
<Tabs
defaultValue="overview"
orientation="horizontal"
>
<TabsList>
<TabsTrigger
value="overview"
>Overview</TabsTrigger>
<TabsTrigger
value="activity"
>Activity</TabsTrigger>
</TabsList>
<TabsContent
value="overview"
className="rounded-md border p-4 text-sm"
>68 components now have live playgrounds.</TabsContent>
<TabsContent
value="activity"
className="rounded-md border p-4 text-sm"
>The latest quality gates are green.</TabsContent>
</Tabs>68 components now have live playgrounds.
API reference
Generated from the public TypeScript exports in src/ui/tabs.tsx.
Tabs
ComponentProps: React.ComponentProps<typeof TabsPrimitive.Root>TabsList
ComponentProps: React.ComponentProps<typeof TabsPrimitive.List>TabsTrigger
ComponentProps: React.ComponentProps<typeof TabsPrimitive.Trigger>TabsContent
ComponentProps: React.ComponentProps<typeof TabsPrimitive.Content>Accessibility contract
Machine-readable behavior and consumer responsibilities for tabs.
- Support
- Primitive-managed
- Pattern
- tabs
- Radix Tabs
| Keys | Behavior |
|---|---|
| ArrowLeft ArrowRight Home End | Move focus and selection between tabs according to orientation. |
| Tab | Move from the active tab into its tabpanel. |
Built-in semantics
- Manages tablist, tab and tabpanel roles plus aria-selected/controls linkage.
Consumer responsibilities
- Give every trigger a concise label and keep each panel associated with one trigger.