Menu

Tabs

Tab item + tab bar. 3 styles × 4 states.

First flush Darjeeling, picked in March and packed in Dhaka.

Installation

$ npx uix-ui@latest add tabs

This copies the file into components/ui/tabs.tsx in your project. npx shadcn@latest add @uix/tabs works too.

Usage

tabs.tsx
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";

<Tabs value={tab} onValueChange={setTab} style={{ width: 360, maxWidth: "100%" }}>
  <TabsList>
    <TabsTrigger value="details">Details</TabsTrigger>
    <TabsTrigger value="brewing">Brewing</TabsTrigger>
    <TabsTrigger value="reviews">Reviews</TabsTrigger>
  </TabsList>
  <TabsContent value="details">First flush Darjeeling, picked in March and packed in Dhaka.</TabsContent>
  <TabsContent value="brewing">Use water just off the boil and steep for three minutes.</TabsContent>
  <TabsContent value="reviews">128 reviews, 4.8 on average.</TabsContent>
</Tabs>

Examples

Pill and boxed

All 14 teas
All 14 teas

Icons and counts

12 orders this month.

Props

Tabs props

PropTypeDefaultDescription
appearanceunderline | pill | boxed"underline"
valuestring–
onValueChange(value: string) => void–

TabsTriggerProps

PropTypeDefaultDescription
valuestring–
leadingIconReact.ReactNode–Icon before the label.
countReact.ReactNode–Number pill after the label.

TabsContentProps

PropTypeDefaultDescription
valuestring–

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
This file exports 4 parts: Tabs, TabsList, TabsTrigger, TabsContent. Use only the ones you need.
esc

↑↓ to navigate · ↵ to select · esc to close