Captain UI

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/sheet
Pro

Run 1187, billing-service

Fix invoice rounding

  1. Read billing/invoice.ts and 3 callers0:42
  2. Wrote 7 tests for half-even rounding1:58
  3. Ran pnpm test billing, 41 passed2:31
  4. Opened pull request #4824:12

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

PropTypeDefaultWhat it does
Sheet openbooleanControlled open state. Pair with onOpenChange.
Sheet defaultOpenbooleanfalseOpen on mount when uncontrolled.
SheetPagecomponentWrap the page behind. It scales and rounds with the drag, never on its own timer.
SheetContent titleReactNodeRequired. Wired to aria-labelledby.
SheetContent detents("peek" | "half" | "full" | number)[]["peek", "half", "full"]Rest heights. Numbers are px.
SheetContent defaultDetentnumber1Index of the detent it opens to.
SheetContent peekHeightnumber148Height of the peek detent in px.
SheetContent containerRefObject<HTMLElement>Render inside this element instead of the viewport.
SheetContent dismissiblebooleantrueAllow dragging below the lowest detent, the scrim and Esc to close it.
data-sheet-no-dragattributePut 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.