Sheet
A bottom sheet that peeks, rests at half or fills the screen. It follows your finger 1:1, a flick carries it one detent, and the page behind recedes as it rises.
npx shadcn@latest add @captain/sheetRun 1187, billing-service
Fix invoice rounding
- Read billing/invoice.ts and 3 callers0:42
- Wrote 7 tests for half-even rounding1:58
- Ran pnpm test billing, 41 passed2:31
- Opened pull request #4824:12
Sheet is a Pro component
The demo and the docs are free. The source comes with Pro, through this page, the shadcn CLI and the MCP.
Usage
import { Sheet, SheetTrigger, SheetPage, SheetContent } from "@/components/ui/sheet"
<Sheet>
<SheetPage>
…your page…
<SheetTrigger>Review changes</SheetTrigger>
</SheetPage>
<SheetContent title="14 files changed" detents={["peek", "half", "full"]}>
…a list that scrolls once the sheet is full…
</SheetContent>
</Sheet>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| Sheet open | boolean | Controlled open state. Pair with onOpenChange. | |
| Sheet defaultOpen | boolean | false | Open on mount when uncontrolled. |
| SheetPage | component | Wrap the page behind. It scales and rounds with the drag, never on its own timer. | |
| SheetContent title | ReactNode | Required. Wired to aria-labelledby. | |
| SheetContent detents | ("peek" | "half" | "full" | number)[] | ["peek", "half", "full"] | Rest heights. Numbers are px. |
| SheetContent defaultDetent | number | 1 | Index of the detent it opens to. |
| SheetContent peekHeight | number | 148 | Height of the peek detent in px. |
| SheetContent container | RefObject<HTMLElement> | Render inside this element instead of the viewport. | |
| SheetContent dismissible | boolean | true | Allow dragging below the lowest detent, the scrim and Esc to close it. |
| data-sheet-no-drag | attribute | Put it on anything inside that must not start a drag. |
Keyboard
- ↑ / ↓ on the handle
- Next or previous detent
- Tab
- Cycles inside while at half or full
- Esc
- Close and return focus
Accessibility
- role=dialog, aria-modal from half height up; at peek the page stays usable and focus is free.
- The handle is a real button: arrows move between detents, click steps up.
- Focus moves into the sheet when it becomes modal and back to the trigger when it closes.
- Under reduced motion the page behind does not scale and nothing bounces; dragging still tracks.