Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Sheet for React

Content that slides in from the screen edge.

Installation

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

Anatomy

SheetTrigger
SheetOverlay
SheetPositioner
SheetContent
SheetTitle
SheetDescription
SheetClose

Usage

import { Button } from "@/components/ui/button";
import { Field, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
import {
  Sheet,
  SheetClose,
  SheetContent,
  SheetDescription,
  SheetFooter,
  SheetHeader,
  SheetTitle,
  SheetTrigger,
} from "@/components/ui/sheet";
<Sheet>
  <SheetTrigger asChild>
    <Button variant="outline">Open</Button>
  </SheetTrigger>
  <SheetContent>
    <SheetHeader>
      <SheetTitle>Edit profile</SheetTitle>
      <SheetDescription>
        Make changes to your profile here. Click save when you&apos;re done.
      </SheetDescription>
    </SheetHeader>
    <div className="grid flex-1 auto-rows-min gap-6 px-4">
      <Field className="grid gap-3">
        <FieldLabel>Name</FieldLabel>
        <Input defaultValue="Pedro Duarte" type="text" />
      </Field>
      <Field className="grid gap-3">
        <FieldLabel>Username</FieldLabel>
        <Input defaultValue="@peduarte" type="text" />
      </Field>
    </div>
    <SheetFooter>
      <Button type="submit">Save changes</Button>
      <SheetClose asChild>
        <Button variant="outline">Close</Button>
      </SheetClose>
    </SheetFooter>
  </SheetContent>
</Sheet>

Accessibility

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

Demos

Side

Use the side prop on SheetContent to set the edge of the screen where the sheet appears.

No Close Button

Use showCloseButton={false} on SheetContent to hide the close button.

Rtl

Right-to-left sheet. See the RTL configuration guide for document direction.

API Reference

Sheet

PropType
childrenReact.ReactNode
AttributeType

SheetTrigger

PropType
childrenReact.ReactNode
className?string
AttributeType

SheetClose

PropType
childrenReact.ReactNode
AttributeType

SheetOverlay

PropType
childrenReact.ReactNode
AttributeType

SheetContent

PropType
childrenReact.ReactNode
className?string

SheetHeader

PropType
childrenReact.ReactNode
AttributeType

SheetFooter

PropType
childrenReact.ReactNode
AttributeType

SheetTitle

PropType
childrenReact.ReactNode

SheetDescription

PropType
childrenReact.ReactNode