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

Sheet
├── SheetTrigger
└── SheetContent
    ├── SheetHeader
    │   ├── SheetTitle
    │   └── SheetDescription
    ├── SheetBody
    └── SheetFooter
        └── SheetClose

Usage

import { 
  Sheet, 
  SheetContent, 
  SheetDescription, 
  SheetHeader, 
  SheetTitle, 
  SheetTrigger 
} from "@/components/ui/sheet";
<Sheet>
  <SheetTrigger>Open</SheetTrigger>
  <SheetContent>
    <SheetHeader>
      <SheetTitle>Sheet Title</SheetTitle>     
      <SheetDescription>Sheet Description</SheetDescription>
    </SheetHeader>
  </SheetContent>
</Sheet>

Controlled

Use open and onOpenChange on the root to control the sheet state.

Sides

Control which side the sheet slides in from using the side prop.

Examples

Inset Variant

Use the variant="inset" prop to add padding. The sheet appears as a floating card.

Scrollable

Use SheetBody to make the content area scrollable while keeping header and footer fixed.

No Close Button

Use the showCloseButton={false} prop to hide the close button in the top right corner.

Close behavior

Use closeOnInteractOutside and closeOnEscape props to prevent closing on outside click and escape.

Non-Modal

Use modal={false} to allow interaction with elements outside the sheet.

Custom spacing

Use [--space:--spacing("value")] on SheetContent to adjust internal padding.

Default spacing is --spacing(6).

You can use breakpoint utilities to change the internal spacing at different screen sizes.

  md:[--space:--spacing(6)] lg:[--space:--spacing(8)]

API Reference

Sheet

Root component. Uses Ark UI Dialog. Controls open state and slide direction.

PropTypeDefault
openboolean-
defaultOpenbooleanfalse
onOpenChange({ open }: OpenChangeDetails) => void-
modalbooleantrue
closeOnEscapebooleantrue
closeOnInteractOutsidebooleantrue
initialFocusEl() => MaybeElement-
finalFocusEl() => MaybeElement-
onEscapeKeyDown(event: KeyboardEvent) => void-
onInteractOutside(event: InteractOutsideEvent) => void-
classNamestring-

SheetTrigger

Opens the sheet on click. Use asChild for custom triggers.

PropTypeDefault
asChildbooleanfalse
classNamestring-

SheetContent

Holds the sheet panel. Slides in from the configured edge.

PropTypeDefault
side"right" | "left" | "top" | "bottom""right"
variant"default" | "inset""default"
showCloseButtonbooleantrue
classNamestring-
AttributeDefault
--space--spacing(6)

SheetHeader

Header area for title and description.

PropTypeDefault
titlestring-
descriptionstring-
classNamestring-

SheetBody

Scrollable body content. Uses ScrollArea for overflow.

PropTypeDefault
scrollFadebooleanfalse
classNamestring-

SheetFooter

Footer area for action buttons.

PropTypeDefault
classNamestring-

SheetTitle

Accessible title. Announced to screen readers.

PropTypeDefault
asChildbooleanfalse
classNamestring-

SheetDescription

Accessible description. Announced to screen readers.

PropTypeDefault
asChildbooleanfalse
classNamestring-

SheetClose

Closes the sheet on click.

PropTypeDefault
asChildbooleanfalse
classNamestring-

SheetOverlay

Dimmed overlay behind the sheet.

PropTypeDefault
classNamestring-

SheetPositioner

Positioning wrapper for sheet content. Used internally; expose for custom layouts.

PropTypeDefault
side"right" | "left" | "top" | "bottom"-
variant"default" | "inset""default"
classNamestring-

For a complete list of props, see the Ark UI documentation.