Atoms

Tabs

Tabbed navigation built on Radix UI.

shadcn/ui
Docs

Line#

Use variant="line" for an underlined tab style. Triggers can carry trailing count chips — handy for showing how many items each tab holds.

Vertical#

Set orientation="vertical" to stack the triggers beside the content.

Scroll#

Set scroll on TabsList when the triggers can be wider than the container. The list is then never wider than its container, and it scrolls horizontally. The triggers do not shrink and do not wrap. Use it with the horizontal orientation only.

Case sensitive#

By default, the labels are in uppercase. Set caseSensitive on a trigger to keep the case of its label, for example a file name.

Installation#

npx shadcn@latest add @formance/tabs

Install the following dependencies:

npm install radix-ui class-variance-authority

Copy and paste the following code into your project.

Update the import paths to match your project setup.

Usage#

import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'
<Tabs defaultValue="transactions">  <TabsList>    <TabsTrigger value="transactions">Transactions</TabsTrigger>    <TabsTrigger value="accounts">Accounts</TabsTrigger>    <TabsTrigger value="metadata">Metadata</TabsTrigger>  </TabsList>  <TabsContent value="transactions">    Browse and filter all ledger transactions.  </TabsContent>  <TabsContent value="accounts">    View account balances and details.  </TabsContent>  <TabsContent value="metadata">    Inspect and edit transaction metadata.  </TabsContent></Tabs>

API reference#

Tabs#

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"The direction of the triggers.
...propsTabsPrimitive.Root props-Props given to the Radix Tabs.Root.

TabsList#

PropTypeDefaultDescription
variant"default" | "line""default"The visual treatment.
scrollbooleanfalseHorizontal orientation only. The list is never wider than its container and scrolls when its triggers do not fit.
...propsTabsPrimitive.List props-Props given to the Radix Tabs.List.

TabsTrigger#

PropTypeDefaultDescription
valuestring-Required. The value of the tab that the trigger opens.
caseSensitivebooleanfalseKeep the case of the label. By default, the label is in uppercase.
...propsTabsPrimitive.Trigger props-Props given to the Radix Tabs.Trigger.