Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Sheet with Tabs for React

An Open Sheet button reveals Project Details with Overview, Activity, and Settings tabs, starting on Overview.

The title is Project Details, with the line View and manage project information. Overview, Activity, and Settings are tabs, and Overview's paragraph is the one showing.

Use it when one record has a few views that share a panel. An Accordion fits if more than one section should stay open. In React, Base UI does not switch this tab text.

Preview

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
Use email insteadNo credit card

Anatomy

Sheet anatomy: content, close, title, description, footer

Usage

<Sheet>
  <SheetTrigger render={<Button />}>Open Sheet</SheetTrigger>
  <SheetContent>
    <SheetHeader>
      <SheetTitle>Project Details</SheetTitle>
      <SheetDescription>View and manage project information</SheetDescription>
    </SheetHeader>
    <Tabs className="p-4" defaultValue="overview">
      <TabsList variant="line">
        {TABS.map((tab) => (
          <TabsTrigger key={tab.id} value={tab.id}>
            {tab.label}
          </TabsTrigger>
        ))}
      </TabsList>
      {TABS.map((tab) => (
        <TabsContent
          className="text-muted-foreground text-sm"
          key={tab.id}
          value={tab.id}
        >
          {tab.content}
        </TabsContent>
      ))}
    </Tabs>
  </SheetContent>
</Sheet>

FAQ

How are the tabs built?

With Tabs, TabsList, TabsTrigger and TabsContent, mapped from a static array of three tabs. Overview is the default tab. TabsList uses variant="line", and each trigger and panel share a value.

How do people move between tabs with the keyboard?

Tab moves focus onto the selected tab, and the arrow keys move between tabs. Tab again moves into the panel.

How do I open the sheet on a given tab?

Control the tabs: keep the value in state, set it before you open the sheet, and update it on change. Pass value and onValueChange.

What's in each tab?

One paragraph of muted text per tab. Replace it with the real panel: a member list, an activity feed, a settings form.

How does Open Sheet open it?

The button labeled Open Sheet is the trigger, and its text is the accessible name. The Button goes in the render prop of SheetTrigger, and the label stays its child.

What does the sheet announce?

SheetTitle names the dialog for assistive tech, so every sheet renders one; hide it with sr-only when the design has no visible heading. It reads Project Details, with View and manage project information as the description.

API Reference

Sheet

No extra props in this demo. The rest is on the Sheet page.

Button

No extra props in this demo. The rest is on the Button page.

Tabs

Sets defaultValue="overview", variant="line" and value={tab.id}. The rest is on the Tabs page.