Tabs
An animated tab switcher component with fluid spring layout indicators.
Loading component...
Installation
Install using the CLI:
bash
bunx knot-ui add tabsOr copy the source code manually from the Code tab above.
Usage
bash
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
export default function Example() {
return (
<Tabs defaultValue="account" variant="pill">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">
<p>Make changes to your account here.</p>
</TabsContent>
<TabsContent value="password">
<p>Change your password here.</p>
</TabsContent>
</Tabs>
);
}Props
Tabs
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string | "" | The value of the tab that should be active initially |
value | string | undefined | The controlled value of the active tab |
onValueChange | (value: string) => void | undefined | Callback fired when the active tab changes |
variant | "pill" | "segment" | "underline" | "pill" | Visual indicator style variant |
TabsTrigger
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | required | A unique value identifying the tab |
indicatorClassName | string | undefined | Custom styling for the sliding active indicator |