Drawer
A drawer component for React. Built on top of Vaul.
Installation#
pnpm dlx shadcn@latest add @davinciui/drawerUsage#
Composition: Drawer → DrawerTrigger + DrawerContent → DrawerHeader → DrawerTitle + DrawerDescription + DrawerFooter + DrawerClose.
Scrolling: Keep header/footer pinned with DrawerBody — the dedicated scroll region between DrawerHeader and DrawerFooter.
Sides: Use direction="top | right | bottom | left" on Drawer. Responsive pattern: Dialog on desktop + Drawer on mobile via media query.
Composition#
Use the following composition to build a Drawer:
Drawer
├── DrawerTrigger
└── DrawerContent
├── DrawerHandle
├── DrawerHeader
│ ├── DrawerTitle
│ └── DrawerDescription
├── DrawerBody
└── DrawerFooterAPI Reference#
| Prop | Type | Default |
|---|---|---|
DrawerRoot. Props: direction, shouldScaleBackground, open, onOpenChange. | Component | — |
DrawerTriggerButton that opens the drawer. Supports asChild. | Component | — |
DrawerContentSlide-out panel with grabber. Props: showHandle (default true). Handles direction via data attribute. | Component | — |
DrawerHandleiOS-style grabber for top/bottom sheets. | Component | — |
DrawerHeaderHeader wrapper. | Component | — |
DrawerBodyScrollable body region; keeps header/footer pinned. | Component | — |
DrawerTitleAccessible title. | Component | — |
DrawerDescriptionAccessible description. | Component | — |
DrawerFooterFooter for actions. | Component | — |
DrawerCloseClose button. Supports asChild. | Component | — |
directionSide of the drawer. | "top" | "right" | "bottom" | "left" | "bottom" |
classNameAdditional CSS classes. | string | — |
Accessibility#
Vaul supplies focus trapping, Escape dismissal, aria-modal dialog semantics, and focus return, with DrawerTitle and DrawerDescription wired for labelling. The grabber is aria-hidden and pointer-only, so swipe dismissal has no keyboard equivalent beyond Escape. Add your own labelled close control.
Motion#
Vaul's internal spring physics drive slide-in, drag, snap, and background scaling; the overlay uses a 200ms opacity fade disabled by motion-reduce. No duration or easing props are forwarded, and vaul does not detect prefers-reduced-motion, so sheet movement continues for reduced-motion users.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

