Make your AI a shadcn expert

Shadcn Tabs

React tabs for settings screens and dashboard views. Built with TypeScript and Tailwind CSS for Next.js using Base UI — one panel at a time, keyboard navigation.

The shadcn tabs component is a row of labels with one panel showing. Click a label — or arrow to it — and that panel replaces the last one. Use it for settings, dashboards, and any screen where the labels should stay in view while the details swap.

Scroll to load preview...

Looking for a neobrutalism version for shadcn?

Same tabs, thicker borders. The NeoBrutalism tabs is the kit if you want that look.

Usage

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">Make changes to your account here.</TabsContent>
  <TabsContent value="password">Change your password here.</TabsContent>
</Tabs>

defaultValue picks the open panel. It has to match a trigger value.

Composition

TabsTrigger
TabsTrigger
TabsContent
TabsContent

Line

variant="line" on TabsList. Underline instead of the pill.

Scroll to load preview...

Vertical

orientation="vertical" on Tabs. Arrow keys go up and down.

Scroll to load preview...

Disabled

disabled on TabsTrigger. It stays in the list so the gap is obvious.

Scroll to load preview...

Icons

Drop an icon in the trigger next to the label. Keep the text.

Scroll to load preview...

RTL

Wrap with DirectionProvider and dir="rtl". Triggers follow the reading direction.

Scroll to load preview...

API

Prop

Type

TabsList

Prop

Type

TabsTrigger

Prop

Type

TabsContent

Prop

Type

TabsList and TabsTrigger take className.

Keyboard

KeyAction
ArrowLeft / ArrowRightNext / previous trigger (horizontal)
ArrowUp / ArrowDownNext / previous trigger (vertical)
Home / EndFirst / last trigger
Space / EnterActivate the focused trigger
TabMove focus into the active panel

Default activationMode is automatic — arrows also switch the panel.

Notes

Inactive is hidden, not unmounted

Fields in a hidden panel still submit with the form. Only render that TabsContent while its value is selected if they should not post.

Do not use tabs as site navigation. That is a Navigation Menu.

With other components

Questions

Was this page helpful?

Sign in to leave feedback.