Review the checklist without leaving the page.Tapto continue.
Credits
Drawer is built on top of Vaul by emilkowalski.
Installation
npx shadcn@latest add @iconiq/drawerProps
Drawer
7 props
Vaul-backed drawer root that coordinates open state, drag gestures, overlay dismissal, focus management, and side-based placement for the compound parts.
open
booleanOptional controlled open state. Pair it with onOpenChange when parent state should own the drawer lifecycle.
defaultOpen
booleanInitial open state for uncontrolled usage. Vaul skips the first enter animation when the drawer is mounted open.
onOpenChange
(open: boolean) => voidCalled whenever the drawer opens or closes from the trigger, overlay, Escape key, close part, or drag release.
direction
"left" | "right" | "top" | "bottom"Default
"bottom"Chooses the drawer edge and matching Vaul slide direction. The content classes style each direction with the appropriate inset and rounded leading edge.
modal
booleanDefault
trueKeeps focus and outside interaction modal while the drawer is open. Set false for non-modal command surfaces.
dismissible
booleanDefault
trueAllows overlay click, Escape, and drag gestures to close the drawer. Controlled drawers can disable this when a flow must be completed explicitly.
snapPoints
(number | string)[]Optional Vaul snap points for stepped drawer heights or widths. Values may be percentages or px strings.
Notes
The root accepts the full Vaul Root prop surface, including drag callbacks, activeSnapPoint, closeThreshold, shouldScaleBackground, and container.
Direction defaults to bottom at the Vaul layer, while the docs preview switches between bottom on small screens and right on larger screens.
Compound parts
5 props
The registry entry exports the familiar shadcn-style DrawerTrigger, DrawerPortal, DrawerOverlay, DrawerContent, DrawerClose, DrawerHeader, DrawerFooter, DrawerTitle, and DrawerDescription parts.
DrawerTrigger
Vaul Trigger propsOpens the drawer. Use asChild when a local button or link should remain the visible trigger element.
DrawerContent
Vaul Content propsPortals the overlay and animated panel, applies direction-aware layout classes, and renders the optional bottom drag handle.
DrawerClose
Vaul Close propsCloses the drawer. Use asChild to turn an existing footer action into the close control.
DrawerHeader / DrawerFooter
div propsLayout helpers for the title area and bottom action area. Both merge className with the default spacing.
DrawerTitle / DrawerDescription
Vaul Title and Description propsAccessible heading and helper text parts forwarded to Vaul's dialog title and description primitives.
Notes
DrawerPortal is kept as an exported part for API symmetry, while DrawerContent composes it automatically for the common overlay-plus-panel path.
DrawerTitle and DrawerDescription should be included inside DrawerHeader when the panel needs accessible labeling.
Motion and layout
2 props
The component leans on Vaul's drag-aware transform animation, then adds softer overlay timing, tuned animation duration, and direction-specific panel geometry.
overlay
built-inA fixed full-screen overlay fades in behind the drawer and uses a subtle black tint with backdrop blur support.
content
built-inThe panel gets a fluid cubic-bezier open curve, a shorter close duration, GPU-friendly transform hints, and a slightly extended initial transform for a softer arrival.
Notes
Bottom drawers show the handle by default; top, left, and right drawers keep the content surface clean unless you add your own handle.
DrawerContent marks rendered children as non-draggable so selecting text inside the panel does not trigger Vaul's drag-to-close gesture.
The motion classes include reduced-motion fallbacks that remove the added Tailwind animation layer while leaving Vaul's accessibility semantics intact.
Top and bottom drawers cap at 80vh, while left and right drawers use a three-quarter width with a small-screen max width at the sm breakpoint.