Tabs

A tabs for switching between views, with a plain tab bar variant.

Installation

pnpm dlx shadcn@latest add @cupertinoui/tabs

The first install also adds the macOS theme. See Installation to set up the registry.

Usage

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

<Tabs defaultValue="general">
  <TabsList>
    <TabsTrigger value="general">General</TabsTrigger>
    <TabsTrigger value="advanced">Advanced</TabsTrigger>
  </TabsList>
  <TabsContent value="general">…</TabsContent>
  <TabsContent value="advanced">…</TabsContent>
</Tabs>

Examples

With symbols

Tab bar

variant="line" renders a plain tab bar with an accent underline.

API Reference

Every part forwards the props of the underlying Base UI Tabs part. The props below are the ones CupertinoUI adds or changes.

Tabs

PropTypeDescription
value / defaultValuestringThe selected segment.
onValueChange(value: string) => voidCalled when the selection changes.
orientation"horizontal" | "vertical"
Default: "horizontal"
Lay the segments out in a row or a column.

TabsList

PropTypeDescription
variant"default" | "line"
Default: "default"
Tabs or tab bar.
classNamestringExtra classes, merged with the component's own.

TabsTrigger

PropTypeDescription
valuestringThe value of this segment.
classNamestringExtra classes, merged with the component's own.