Tabs
Displays a list of options for the user to pick from—triggered by a button.
Installation
npm @momo-ui add tabs
Usage
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
app.js
<Tabs defaultValue="account">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
</TabsList>
<TabsContent value="account">Make changes to your account here.</TabsContent>
<TabsContent value="password">Change your password here.</TabsContent>
</Tabs>
API Reference
Tabs
Prop | Type | Default | Required |
value | string | -- | false |
defaultValue | string | -- | false |
onValueChange | (value: string) => void | -- | false |
orientation | enumhorizontal | vertical | -- | false |
dir | enumDirection | -- | false |
activationMode | enumautomatic | manual | -- | false |
asChild | enumboolean | -- | false |
TabsList
Prop | Type | Default | Required |
asChild | enumboolean | -- | false |
loop | enumboolean | -- | false |
size | enumbase | sm | sm | false |
isDivider | enumboolean | false | false |
TabsTrigger
Prop | Type | Default | Required |
asChild | enumboolean | -- | false |
value | string | -- | true |
TabsContent
Prop | Type | Default | Required |
asChild | enumboolean | -- | false |
value | string | -- | true |
forceMount | true | -- | false |
Example
Sizes
Use the size prop to control the size of the tabs list.
With divider
By default, Tabs has no divider, but you can add it by providing variant prop to the TabsList