Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Sheet for React and Tailwind

Content that slides in from the screen edge.

Installation

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

Anatomy

SheetTrigger
SheetBackdrop
SheetOverlay
SheetContent
SheetTitle
SheetDescription
SheetClose

Usage

import { Button } from "@/components/ui/button";
import {
  Field,
  FieldGroup,
  FieldLabel,
} from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import {
  Sheet,
  SheetBody,
  SheetClose,
  SheetContent,
  SheetFooter,
  SheetHeader,
  SheetTrigger,
} from "@/components/ui/sheet";
<Sheet>
  <SheetTrigger asChild>
    <Button variant="outline">Open</Button>
  </SheetTrigger>
  <SheetContent>
    <SheetHeader
      description="Make changes to your account here. Click save when you're done."
      title="Edit User"
    />
    <SheetBody>
      <FieldGroup>
        <Field>
          <FieldLabel>Name</FieldLabel>
          <Input defaultValue="Vinicius Vicentini" />
        </Field>
        <Field>
          <FieldLabel>Username</FieldLabel>
          <Input defaultValue="@vinihvc" />
        </Field>
      </FieldGroup>
    </SheetBody>
    <SheetFooter>
      <SheetClose asChild>
        <Button variant="outline">Cancel</Button>
      </SheetClose>
      <SheetClose asChild>
        <Button>Save changes</Button>
      </SheetClose>
    </SheetFooter>
  </SheetContent>
</Sheet>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Close Behavior

Close Button

Controlled

Custom Spacing

Inset

No Close Button

Non Modal

Scroll Area

Sides

API Reference

Sheet

PropType
AttributeType

SheetTrigger

button

PropType
AttributeType

SheetOverlay

div

PropType
AttributeType
CSS variableType

SheetContent

div

PropType
AttributeType

SheetClose

button

PropType
AttributeType

SheetPositioner

div

PropType
AttributeType
CSS variableType

SheetHeader

PropType
AttributeType

SheetTitle

PropType
AttributeType

SheetDescription

PropType
AttributeType

SheetBody

PropType
AttributeType

SheetFooter

PropType
AttributeType

useSheet