Tabs
NavigationTabbed interface for switching between content panels. Supports controlled and uncontrolled modes.
Responsive viewport — resize the window to explore. Direction and density apply only to this preview. Theme applies to the docs too.
"use client";
import {
Tabs,
TabsList,
TabsTrigger,
TabsContent,
} from "@dashboardpack/core/components/ui/tabs";
export default function TabsExample() {
return (
<Tabs defaultValue="overview" className="w-full max-w-md">
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="activity">Activity</TabsTrigger>
<TabsTrigger value="billing" disabled>
Billing
</TabsTrigger>
</TabsList>
<TabsContent value="overview" className="rounded-xl border p-5">
<h3 className="font-medium">Workspace overview</h3>
<p className="mt-2 text-sm text-muted-foreground">
Your team has 12 active projects.
</p>
</TabsContent>
<TabsContent value="activity" className="rounded-xl border p-5">
<h3 className="font-medium">Recent activity</h3>
<p className="mt-2 text-sm text-muted-foreground">
Alex created a new project.
</p>
</TabsContent>
</Tabs>
);
}Usage
Use TabsList and TabsTrigger to switch between related TabsContent panels. Set defaultValue for an uncontrolled group or value and onValueChange for controlled state.
import {
Tabs,
TabsList,
TabsTrigger,
TabsContent,
} from "@dashboardpack/core/components/ui/tabs";Available in the included @dashboardpack/core package. Copy the complete example from Source code for all imports and state. Add "use client" when using hooks or event handlers. See installation and theming for project setup.
API reference
Common props and defaults. Slot-specific props are named below; native elements also accept their standard HTML attributes. The component TypeScript definitions are the complete type reference.
| Prop | Type / Default | Description |
|---|---|---|
| value / defaultValue | stringDefault: — | Controlled or initial active tab. |
| onValueChange | (value: string) => voidDefault: — | Handle active-tab changes. |
| orientation | horizontal | verticalDefault: horizontal | Keyboard navigation direction. |
| activationMode | automatic | manualDefault: automatic | Whether focusing a tab activates it. |
| disabled (TabsTrigger) | booleanDefault: false | Prevent tab activation. |