Sheet
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/sheet.jsonUsage
import {
Sheet,
SheetContent,
SheetDescription,
SheetHeader,
SheetTitle,
SheetTrigger,
} from "@/components/ui/sheet"
<Sheet>
<SheetTrigger asChild>
<Button>Environment variables</Button>
</SheetTrigger>
<SheetContent side="right">
<SheetHeader>
<SheetTitle>Environment variables</SheetTitle>
<SheetDescription>Changes apply to the next deployment.</SheetDescription>
</SheetHeader>
</SheetContent>
</Sheet>Examples
Bottom sheet
Drag the handle or the header down to dismiss. A flick works too. The backdrop thins as you pull.
Mobile navigation
A left sheet sized with className. Links close it after navigating.
API reference
Sheet
Holds the open state. Renders no element of its own.
| Prop | Type | Default |
|---|---|---|
open | booleanControlled open state. | None |
defaultOpen | booleanInitial state when uncontrolled. | false |
onOpenChange | (open: boolean) => voidCalled when the trigger, a close button, Escape, the backdrop or a drag asks to change state. | None |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
SheetTrigger
Renders a button that opens the sheet. Also accepts every native button attribute.
| Prop | Type | Default |
|---|---|---|
asChild | booleanMerges trigger behaviour onto its single child element instead of rendering a button. | false |
SheetContent
The backdrop and panel in a native <dialog> on the top layer. Other props go to the panel; its children scroll inside a padded body.
| Prop | Type | Default |
|---|---|---|
side | "top"The edge it slides in from. The opposite edge is the lit tube. | "right" |
size | "sm"Width for left and right (384, 448, 672px or full), maximum height for top and bottom (40, 65, 85% or full). | "md" |
showClose | booleanShows the X button in the top-right corner. | true |
SheetClose
Renders a button that closes the sheet. Also accepts every native button attribute.
| Prop | Type | Default |
|---|---|---|
asChild | booleanMerges close behaviour onto its single child element instead of rendering a button. | false |
SheetHeader, SheetTitle, SheetDescription, SheetFooter
Layout and text parts. Each accepts the native attributes of its element.
| Prop | Type | Default |
|---|---|---|
SheetHeader | divTitle block. On a bottom sheet it's also a drag handle. | None |
SheetTitle | h2Labels the sheet through aria-labelledby. | None |
SheetDescription | pDescribes the sheet through aria-describedby, only while it's rendered. | None |
SheetFooter | divPinned to the bottom of side sheets. Stacks actions on small screens. | None |
Accessibility
- Opens with showModal(), so the browser makes the page inert and moves focus to the first focusable element in the sheet.
- Escape and clicks on the backdrop close the sheet after its exit slide. Focus returns to the element that opened it.
- Page scroll is locked while it's open; long content scrolls inside the panel.
- Dragging is a pointer shortcut only: the X button, Escape and SheetClose always work.
- Always include a SheetTitle, even a visually hidden one, so the sheet has an accessible name.
- With reduced motion the sheet fades instead of sliding, the tube doesn't flicker and dragging is off.