Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Tabs for React and Tailwind

Mutually exclusive panels in one region.

Profile

Manage your profile information

View you shared information here, update you profile name, picture and email.

Installation

bunx --bun shadcn@latest add https://kit.dev/r/tabs.json

Anatomy

Tabs
├── TabsList
│   └── TabsIndicator
├── TabsTrigger
└── TabsContent

Usage

import {
  Card,
  CardContent,
  CardHeader,
} from "@/components/ui/card";
import {
  Tabs,
  TabsContent,
  TabsList,
  TabsTrigger,
} from "@/components/ui/tabs";
<Tabs defaultValue="tab-1">
  <TabsList>
    <TabsTrigger value="tab-1">Profile</TabsTrigger>
    <TabsTrigger value="tab-2">Settings</TabsTrigger>
    <TabsTrigger value="tab-3">Security</TabsTrigger>
  </TabsList>

  <TabsContent value="tab-1">
    <Card className="h-full w-sm">
      <CardHeader
        description="Manage your profile information"
        title="Profile"
      />

      <CardContent className="text-muted-foreground text-sm">
        View you shared information here, update you profile name, picture and
        email.
      </CardContent>
    </Card>
  </TabsContent>

  <TabsContent value="tab-2">
    <Card className="h-full w-sm">
      <CardHeader description="Update your preferences" title="Settings" />

      <CardContent className="text-muted-foreground text-sm">
        Customize how to handle notifications, update the theme and text
        density.
      </CardContent>
    </Card>
  </TabsContent>

  <TabsContent value="tab-3">
    <Card className="h-full w-sm">
      <CardHeader
        description="Protect your account and data"
        title="Security"
      />
      <CardContent className="text-muted-foreground text-sm">
        Update your security settings here, change your password and more.
      </CardContent>
    </Card>
  </TabsContent>
</Tabs>

Accessibility

KeyDescription
ArrowDown
Move to the next item when orientation is "vertical".
ArrowUp
Move to the previous item when orientation is "vertical".
ArrowLeft
Move to the previous item when orientation is "horizontal".
ArrowRight
Move to the next item when orientation is "horizontal".
Home
Go to the start.
End
Go to the end.
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Context

Controlled

Disabled

Lazy Mount

Manual

Orientation Horizontal

Orientation Vertical

Root Provider

Variant Default

Variant Underline

Variant Underline Orientation Vertical

With Icons

API Reference

Tabs

div

PropType
AttributeType

TabsList

PropType
AttributeType

TabsTrigger

PropType
AttributeType

TabsContent

PropType
AttributeType

TabsIndicator

AttributeType
CSS variableType

TabsRootProvider

div

PropType
AttributeType
CSS variableType

useTabs

PropType

TabsContext

PropType