Get Started
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Card
- Checkbox
- Collapsible
- Combobox
- Context Menu
- Date Picker (Lite)
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP (Lite)
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
A set of layered sections of content—known as tab panels—that are displayed one at a time.
Client JS
Overview
View your key metrics and recent project activity. Track progress across all your active projects.
You have 12 active projects and 3 pending tasks.
Analytics
Track performance and user engagement metrics. Monitor trends and identify growth opportunities.
Page views are up 25% compared to last month.
Reports
Generate and download your detailed reports. Export data in multiple formats for analysis.
You have 5 reports ready and available to export.
Settings
Manage your account preferences and options. Customize your experience to fit your needs.
Configure notifications, security, and themes.
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
export function TabsDemo() {
return (
<Tabs defaultValue="overview" class="w-[400px]">
<TabsList>
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="analytics">Analytics</TabsTrigger>
<TabsTrigger value="reports">Reports</TabsTrigger>
<TabsTrigger value="settings">Settings</TabsTrigger>
</TabsList>
<TabsContent value="overview">
<Card>
<CardHeader>
<CardTitle>Overview</CardTitle>
<CardDescription>
View your key metrics and recent project activity. Track progress
across all your active projects.
</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
You have 12 active projects and 3 pending tasks.
</CardContent>
</Card>
</TabsContent>
<TabsContent value="analytics">
<Card>
<CardHeader>
<CardTitle>Analytics</CardTitle>
<CardDescription>
Track performance and user engagement metrics. Monitor trends and
identify growth opportunities.
</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
Page views are up 25% compared to last month.
</CardContent>
</Card>
</TabsContent>
<TabsContent value="reports">
<Card>
<CardHeader>
<CardTitle>Reports</CardTitle>
<CardDescription>
Generate and download your detailed reports. Export data in
multiple formats for analysis.
</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
You have 5 reports ready and available to export.
</CardContent>
</Card>
</TabsContent>
<TabsContent value="settings">
<Card>
<CardHeader>
<CardTitle>Settings</CardTitle>
<CardDescription>
Manage your account preferences and options. Customize your
experience to fit your needs.
</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
Configure notifications, security, and themes.
</CardContent>
</Card>
</TabsContent>
</Tabs>
)
}Installation
pnpm dlx shadcnui-hono-jsx@latest add tabsnpx shadcnui-hono-jsx@latest add tabsyarn dlx shadcnui-hono-jsx@latest add tabsbunx shadcnui-hono-jsx@latest add tabsThis component uses a small client script. add installs it into public/shadcn/; serve that directory at /shadcn/ and load the script on pages that use the component (see Client Scripts):
<script type="module" src="/shadcn/tabs.js"></script>Usage
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"<Tabs defaultValue="account" class="w-[400px]">
<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>Composition
Use the following composition to build Tabs:
Tabs
├── TabsList
│ ├── TabsTrigger
│ └── TabsTrigger
├── TabsContent
└── TabsContentLine
Use the variant="line" prop on TabsList for a line style.
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
export function TabsLine() {
return (
<Tabs defaultValue="overview">
<TabsList variant="line">
<TabsTrigger value="overview">Overview</TabsTrigger>
<TabsTrigger value="analytics">Analytics</TabsTrigger>
<TabsTrigger value="reports">Reports</TabsTrigger>
</TabsList>
</Tabs>
)
}Vertical
Use orientation="vertical" for vertical tabs.
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
export function TabsVertical() {
return (
<Tabs defaultValue="account" orientation="vertical">
<TabsList>
<TabsTrigger value="account">Account</TabsTrigger>
<TabsTrigger value="password">Password</TabsTrigger>
<TabsTrigger value="notifications">Notifications</TabsTrigger>
</TabsList>
</Tabs>
)
}Disabled
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
export function TabsDisabled() {
return (
<Tabs defaultValue="home">
<TabsList>
<TabsTrigger value="home">Home</TabsTrigger>
<TabsTrigger value="settings" disabled>
Disabled
</TabsTrigger>
</TabsList>
</Tabs>
)
}Icons
import { AppWindowIcon, CodeIcon } from "@/components/icons"
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"
export function TabsIcons() {
return (
<Tabs defaultValue="preview">
<TabsList>
<TabsTrigger value="preview">
<AppWindowIcon />
Preview
</TabsTrigger>
<TabsTrigger value="code">
<CodeIcon />
Code
</TabsTrigger>
</TabsList>
</Tabs>
)
}RTL
To enable RTL support in shadcn/ui, see the RTL configuration guide.
Overview
View your key metrics and recent project activity. Track progress across all your active projects.
You have 12 active projects and 3 pending tasks.
Analytics
Track performance and user engagement metrics. Monitor trends and identify growth opportunities.
Page views are up 25% compared to last month.
Reports
Generate and download your detailed reports. Export data in multiple formats for analysis.
You have 5 reports ready and available to export.
Settings
Manage your account preferences and options. Customize your experience to fit your needs.
Configure notifications, security, and themes.
نظرة عامة
عرض مقاييسك الرئيسية وأنشطة المشروع الأخيرة. تتبع التقدم عبر جميع مشاريعك النشطة.
لديك ١٢ مشروعًا نشطًا و٣ مهام معلقة.
التحليلات
تتبع مقاييس الأداء ومشاركة المستخدمين. راقب الاتجاهات وحدد فرص النمو.
زادت مشاهدات الصفحة بنسبة ٢٥٪ مقارنة بالشهر الماضي.
التقارير
إنشاء وتنزيل تقاريرك التفصيلية. تصدير البيانات بتنسيقات متعددة للتحليل.
لديك ٥ تقارير جاهزة ومتاحة للتصدير.
الإعدادات
إدارة تفضيلات حسابك وخياراته. تخصيص تجربتك لتناسب احتياجاتك.
تكوين الإشعارات والأمان والسمات.
סקירה כללית
הצג את המדדים העיקריים שלך ופעילות הפרויקט האחרונה. עקוב אחר התקדמות בכל הפרויקטים הפעילים שלך.
יש לך 12 פרויקטים פעילים ו-3 משימות ממתינות.
אנליטיקה
עקוב אחר ביצועים ומדדי מעורבות משתמשים. עקוב אחר מגמות וזהה הזדמנויות צמיחה.
צפיות בדף עלו ב-25% בהשוואה לחודש שעבר.
דוחות
צור והורד את הדוחות המפורטים שלך. ייצא נתונים בפורמטים מרובים לניתוח.
יש לך 5 דוחות מוכנים וזמינים לייצוא.
הגדרות
נהל את העדפות החשבון והאפשרויות שלך. התאם אישית את החוויה שלך כך שתתאים לצרכים שלך.
הגדר התראות, אבטחה וערכות נושא.
// This example sets dir and uses useTranslation because this site is not RTL.
// In an RTL app you won't need them; see the RTL guide.
import {
type Translations,
useTranslation,
} from "@/components/language-selector"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
const translations: Translations = {
en: {
dir: "ltr",
values: {
overview: "Overview",
analytics: "Analytics",
reports: "Reports",
settings: "Settings",
overviewTitle: "Overview",
overviewDesc:
"View your key metrics and recent project activity. Track progress across all your active projects.",
overviewContent: "You have 12 active projects and 3 pending tasks.",
analyticsTitle: "Analytics",
analyticsDesc:
"Track performance and user engagement metrics. Monitor trends and identify growth opportunities.",
analyticsContent: "Page views are up 25% compared to last month.",
reportsTitle: "Reports",
reportsDesc:
"Generate and download your detailed reports. Export data in multiple formats for analysis.",
reportsContent: "You have 5 reports ready and available to export.",
settingsTitle: "Settings",
settingsDesc:
"Manage your account preferences and options. Customize your experience to fit your needs.",
settingsContent: "Configure notifications, security, and themes.",
},
},
ar: {
dir: "rtl",
values: {
overview: "نظرة عامة",
analytics: "التحليلات",
reports: "التقارير",
settings: "الإعدادات",
overviewTitle: "نظرة عامة",
overviewDesc:
"عرض مقاييسك الرئيسية وأنشطة المشروع الأخيرة. تتبع التقدم عبر جميع مشاريعك النشطة.",
overviewContent: "لديك ١٢ مشروعًا نشطًا و٣ مهام معلقة.",
analyticsTitle: "التحليلات",
analyticsDesc:
"تتبع مقاييس الأداء ومشاركة المستخدمين. راقب الاتجاهات وحدد فرص النمو.",
analyticsContent: "زادت مشاهدات الصفحة بنسبة ٢٥٪ مقارنة بالشهر الماضي.",
reportsTitle: "التقارير",
reportsDesc:
"إنشاء وتنزيل تقاريرك التفصيلية. تصدير البيانات بتنسيقات متعددة للتحليل.",
reportsContent: "لديك ٥ تقارير جاهزة ومتاحة للتصدير.",
settingsTitle: "الإعدادات",
settingsDesc:
"إدارة تفضيلات حسابك وخياراته. تخصيص تجربتك لتناسب احتياجاتك.",
settingsContent: "تكوين الإشعارات والأمان والسمات.",
},
},
he: {
dir: "rtl",
values: {
overview: "סקירה כללית",
analytics: "אנליטיקה",
reports: "דוחות",
settings: "הגדרות",
overviewTitle: "סקירה כללית",
overviewDesc:
"הצג את המדדים העיקריים שלך ופעילות הפרויקט האחרונה. עקוב אחר התקדמות בכל הפרויקטים הפעילים שלך.",
overviewContent: "יש לך 12 פרויקטים פעילים ו-3 משימות ממתינות.",
analyticsTitle: "אנליטיקה",
analyticsDesc:
"עקוב אחר ביצועים ומדדי מעורבות משתמשים. עקוב אחר מגמות וזהה הזדמנויות צמיחה.",
analyticsContent: "צפיות בדף עלו ב-25% בהשוואה לחודש שעבר.",
reportsTitle: "דוחות",
reportsDesc:
"צור והורד את הדוחות המפורטים שלך. ייצא נתונים בפורמטים מרובים לניתוח.",
reportsContent: "יש לך 5 דוחות מוכנים וזמינים לייצוא.",
settingsTitle: "הגדרות",
settingsDesc:
"נהל את העדפות החשבון והאפשרויות שלך. התאם אישית את החוויה שלך כך שתתאים לצרכים שלך.",
settingsContent: "הגדר התראות, אבטחה וערכות נושא.",
},
},
}
export function TabsRtl() {
const { dir, t } = useTranslation(translations, "ar")
return (
<Tabs defaultValue="overview" class="w-full max-w-sm" dir={dir}>
<TabsList dir={dir}>
<TabsTrigger value="overview">{t.overview}</TabsTrigger>
<TabsTrigger value="analytics">{t.analytics}</TabsTrigger>
<TabsTrigger value="reports">{t.reports}</TabsTrigger>
<TabsTrigger value="settings">{t.settings}</TabsTrigger>
</TabsList>
<TabsContent value="overview">
<Card dir={dir}>
<CardHeader>
<CardTitle>{t.overviewTitle}</CardTitle>
<CardDescription>{t.overviewDesc}</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
{t.overviewContent}
</CardContent>
</Card>
</TabsContent>
<TabsContent value="analytics">
<Card dir={dir}>
<CardHeader>
<CardTitle>{t.analyticsTitle}</CardTitle>
<CardDescription>{t.analyticsDesc}</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
{t.analyticsContent}
</CardContent>
</Card>
</TabsContent>
<TabsContent value="reports">
<Card dir={dir}>
<CardHeader>
<CardTitle>{t.reportsTitle}</CardTitle>
<CardDescription>{t.reportsDesc}</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
{t.reportsContent}
</CardContent>
</Card>
</TabsContent>
<TabsContent value="settings">
<Card dir={dir}>
<CardHeader>
<CardTitle>{t.settingsTitle}</CardTitle>
<CardDescription>{t.settingsDesc}</CardDescription>
</CardHeader>
<CardContent class="text-sm text-muted-foreground">
{t.settingsContent}
</CardContent>
</Card>
</TabsContent>
</Tabs>
)
}Notes
- Switching tabs needs the client script
/shadcn/tabs.js(<script type="module" src="/shadcn/tabs.js">); without it the selected panel is shown. Pointer, Enter, Space, arrow keys, Home and End work like Base UI. - Inactive panels are rendered with
hidden(Base UI does not render them). Controlled state (onValueChange) andrenderare not supported;value/defaultValueset the selected tab. - Accepts
classinstead ofclassName. - Upstream documentation: shadcn/ui Tabs. See also Differences from shadcn/ui.
API Reference
See the Base UI Tabs documentation.