Components

Drawer

A slip of paper you pull up from the bottom of the screen (or in from any edge), built on vaul. From the bottom it is torn off a pad along its top edge with a strip of tape as the grab tab; drag it, flick it away, or give it snap points.

Install

terminal
npx shadcn@latest add @wobko/drawer

First time here? Add the registry to components.json first. How to install

Examples

Move goal

The shadcn demo: a slip pulled up from the bottom, torn along its top edge and taped down by its grab tab. Drag the tape, flick it away, or press Escape.

Snap points

Give the slip resting heights: it stops a third, two thirds or all the way up, and remembers where it is. The list only scrolls at the top snap point so a drag never fights a scroll.

Directions

Pull a slip in from any edge. Only the bottom slip is torn and taped (that is where the grab tab belongs); the others are plain slips you drag toward their edge.

Responsive dialog

A dialog on wide screens and a drawer on phones, from one component. The media query is read with useSyncExternalStore, so the server renders the desktop dialog and the phone swaps in after hydration.

API reference

DrawerContent

The slip: a Paper that is also the vaul drawer. The drag transform vaul writes lands on the sheet, its shadow and the tape together.

PropTypeDefaultDescription
tapeKindTapeKind"kraft"The grab tab's tape (bottom drawers only): kraft, masking, clear or a washi pattern.
tapeColorAccent-The print color of a washi tape.
stockStockName"slip"What the slip is made of.
edgeEdgeSpec{ top: "torn" } from the bottom, "cut" otherwiseHow it is cut.
seedstring | number-Pins the hand.

Accessibility

  • vaul builds on Radix Dialog: role=dialog named by DrawerTitle and described by DrawerDescription, Escape closes, the page behind is inert, and focus returns to the trigger.
  • Focus moves onto the sheet itself when it opens, not onto the first control (vaul's own default leaves it on the trigger behind the dim, and a field would pop a phone keyboard up over the drawer): a screen reader announces the dialog and Tab starts inside it. Pass `autoFocus` on `Drawer` to jump to the first control instead.
  • The drawer sits on the same level of the z-scale as dialogs and sheets (`--ll-z-overlay`), so one opened from a dialog stacks above it by open order. A click on a Sonner toast does not count as "outside" and does not dismiss it. On a phone with a home indicator the sheet pads its bottom by `env(safe-area-inset-bottom)`.
  • Dragging is a pointer shortcut only: every drawer also closes with Escape, the Cancel/Close buttons you provide, or a tap on the dim.
  • The tape is a decorative aria-hidden strip, not a control. With reduced motion the slip simply appears; in `calm` density it is a plain cut slip.

Source

The files the CLI copies into your project.

Loading the source