Sheet
The same native modal as Dialog, sliding in from the right, the left or the bottom. Drag its handle and it follows one to one, resisting the wrong way. On release the spring takes over from exactly where it was let go, carrying the drag's speed: past a third of the way or flicked, it closes; otherwise it settles back. With reduced motion it fades in place.
- <dialog>
- Pointer capture
- Spring Physics
- Velocity handoff
Drag either sheet by its handle. Let go past a third of the way, or flick it, and it closes; otherwise it settles back. The spring starts from exactly where you let go.
Usage
Drop it in
import { Sheet } from "@/app/lib/components/sheet";<Sheet open={open} onOpenChange={setOpen} title="Filters" side="right">
<FilterForm />
</Sheet>API
Props
| Prop | Type | Default |
|---|---|---|
open*Whether it is open. | boolean | — |
onOpenChange*Called with false when it asks to close: Escape, the close button, the backdrop, or a drag past the threshold. | (open: boolean, reason: DismissReason | "drag") => void | — |
title*Names the sheet. Rendered as its heading. | string | — |
descriptionDescribes it, linked with aria-describedby. | ReactNode | — |
children | ReactNode | — |
footerPinned to the bottom of the sheet. | ReactNode | — |
sideWhich edge it comes from. Default: "right" | SheetSide | "right" |
className | string | "" |
Read from the component's source at build time. * required.
Accessibility
Works with
- Cursor
- Reacts to where the pointer is, not just whether it's over the element.
- Touch
- Follows your finger while it's down, then settles a moment after you lift.
- Keyboard
- Focus lights it up the way the cursor does. Every action has a key.
- Reduced motion
- Nothing moves or springs. Colour still answers, without drifting.