Installation
About
Drawer is built on top of Vaul by @emilkowalski.Usage
Component API
Drawer
The root drawer component built on Vaul. Props:open- Control drawer open stateonOpenChange- Callback when open state changesdefaultOpen- Initial open statedirection- Direction the drawer opens from (default:"bottom")- Options:
"top","right","bottom","left"
- Options:
snapPoints- Array of snap points for the drawermodal- Whether drawer is modal (default:true)
DrawerTrigger
The element that opens the drawer.DrawerContent
The drawer content container. Props:- All standard div props
- Automatically includes drag handle for bottom/top drawers
DrawerHeader
Container for title and description.DrawerTitle
The drawer title (required for accessibility).DrawerDescription
The drawer description.DrawerFooter
Container for drawer actions.DrawerClose
Closes the drawer.Examples
Scrollable Content
Keep actions visible while content scrolls:Different Sides
Use thedirection prop to set which side the drawer opens from:
Responsive Dialog
CombineDialog and Drawer for a responsive experience:
Controlled Drawer
Control the drawer open state:Snap Points
Define snap points for the drawer:Accessibility
- Built on Vaul for swipe gestures and animations
- Focus is trapped within the drawer
- Escape key closes the drawer
- Background content is inert when modal
- Screen reader compatible
- ARIA labels and roles