Sheet
A modal panel that slides in from an edge: filters, record details, mobile navigation.
- A short decision: use Dialog.
- Non-blocking side content: render a panel in the layout.
Install
Terminal
pnpm dlx shadcn@latest add @acme/sheetOr import from the package: import { Sheet } from '@acme/react'
Examples
Basic
sheet-basic.tsx
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'
export default function SheetBasic() {
return (
<Sheet>
<SheetTrigger render={<Button variant="outline" />}>Edit customer</SheetTrigger>
<SheetContent side="right">
<SheetHeader>
<SheetTitle>Edit customer</SheetTitle>
<SheetDescription>Changes apply to future invoices only.</SheetDescription>
</SheetHeader>
<Field>
<FieldLabel>Company name</FieldLabel>
<Input defaultValue="Northwind Traders" autoComplete="organization" />
</Field>
<Field>
<FieldLabel>Billing email</FieldLabel>
<Input type="email" defaultValue="ap@northwind.example" autoComplete="email" />
</Field>
<SheetFooter>
<SheetClose render={<Button variant="outline" />}>Cancel</SheetClose>
<SheetClose render={<Button />}>Save</SheetClose>
</SheetFooter>
</SheetContent>
</Sheet>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| SheetContent.side | 'right' | 'left' | 'top' | 'bottom' | 'right' | Edge the sheet slides from. |
| SheetContent.showCloseButton | boolean | true | Show the X button. |
| open / onOpenChange | boolean / fn | — | Controlled state. |
Accessibility
| Key | Action |
|---|---|
| Tab / Shift+Tab | Cycle focus inside the sheet |
| Escape | Closes and returns focus to the trigger |
- Role
- dialog (aria-modal)
- You provide
- A SheetTitle.
- Built in
- Slide animation becomes a fade under reduced motion.
- WCAG 2.2 criteria
- 2.1.2, 2.4.3, 4.1.2
Don’t
- Stack sheets on sheets.
Tokens
- color.popover
- color.scrim
- elevation.3
- z.overlay
- z.modal