Credits
Drawer is built on top of Vaul by emilkowalski.
Installation
npx shadcn@latest add @iconiq/drawerProps
Drawer
Vaul-backed drawer root that coordinates open state, drag gestures, overlay dismissal, focus management, and side-based placement for the compound parts.
openbooleandefaultOpenbooleanonOpenChange(open: boolean) => voiddirection"left" | "right" | "top" | "bottom"Default "bottom"
modalbooleanDefault true
dismissiblebooleanDefault true
snapPoints(number | string)[]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.
DrawerTrigger
Opens the drawer from a button, link, or custom interactive target.
asChildbooleanchildrenReactNodeRequired
DrawerPortal
Portal wrapper for drawer overlay and panel content. DrawerContent composes it automatically in the common path.
childrenReactNodeRequired
DrawerPortal is kept as an exported part for API symmetry, while DrawerContent composes it automatically for the common overlay-plus-panel path.
DrawerOverlay
Full-screen overlay rendered behind the drawer panel.
classNamestringDrawerContent
Portals the overlay and animated panel, applies direction-aware layout classes, and renders the optional bottom drag handle.
childrenReactNodeRequired
classNamestringDrawerContent marks rendered children as non-draggable so selecting text inside the panel does not trigger Vaul's drag-to-close gesture.
DrawerClose
Closes the drawer from a button or custom interactive target.
asChildbooleanchildrenReactNodeRequired
DrawerHeader
Layout helper for the title area at the top of the drawer panel.
childrenReactNodeRequired
classNamestringDrawerFooter
Layout helper for actions or supporting context at the bottom of the drawer.
childrenReactNodeRequired
classNamestringDrawerTitle
Accessible heading part forwarded to Vaul's dialog title primitive.
childrenReactNodeRequired
classNamestringDrawerDescription
Accessible helper text part forwarded to Vaul's dialog description primitive.
childrenReactNodeRequired
classNamestringDrawerTitle and DrawerDescription should be included inside DrawerHeader when the panel needs accessible labeling.
Motion and layout
The component leans on Vaul's drag-aware transform animation, then adds softer overlay timing, tuned animation duration, and direction-specific panel geometry.
overlaybuilt-incontentbuilt-inBottom 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.
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.
Registry bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together.
Dependencies: vaul.
This page documents the Vaul install only. The Base UI and Radix UI provider options are visible for section consistency but disabled because this drawer is not a primitive-specific wrapper.
The generated registry file is /r/drawer.json.