Basic Usage
Props Reference
Component that opens the drawer when clicked
Drawer heading
Descriptive text below the title
Main drawer content
Direction
Which edge the drawer slides from
Controlled State
Whether drawer is open (controlled)
Initial open state (uncontrolled)
Event fired when drawer opens or closes
Event fired after animation completes
Modal vs Non-Modal
True: Blocks interaction with page, shows overlayFalse: Allows interaction with page behind drawer
Dismissible
Whether clicking outside or dragging closes the drawer
Drag Behavior
When True, dragging only works on the handle element
Snap Points
Snap positions as percentages or pixel values (e.g., [0.25, 0.5, 1])
Currently active snap point index
Compositional API
Drawer Components
drawer.root
Container for all drawer parts.drawer.trigger
Button that opens the drawer.drawer.portal
Portals the drawer to document body.drawer.overlay
Dark overlay behind drawer (when modal).drawer.content
Main drawer panel.drawer.title
Accessible heading for the drawer.drawer.description
Accessible description.drawer.close
Button to close the drawer.drawer.handle
Drag handle for mobile-friendly interaction.Styling Classes
Access predefined styles viaui.drawer.class_names:
ROOT: Root element (empty by default)TRIGGER: Trigger element (empty by default)PORTAL: Portal element (empty by default)CONTENT: Drawer panel with border and backgroundOVERLAY: Semi-transparent backdropCLOSE: Close button (empty by default)TITLE: Large semibold headingDESCRIPTION: Secondary textHANDLE: Drag handle (empty by default)
Container
DOM element to render drawer into (default: document.body)
Input Repositioning
Automatically repositions inputs when drawer opens on mobile
Library
The drawer component uses the[email protected] library, which provides smooth, gesture-based drawer interactions.
Accessibility
- Keyboard accessible (Escape to close)
- Focus management
- ARIA attributes
- Screen reader support
- Touch and mouse drag support
Implementation Details
From source code atreflex_ui/components/base/drawer.py:220:
- Built on Vaul library (vaul-base package)
- High-level wrapper creates complete structure
- Auto-includes overlay and portal
- Fixed positioning on right side by default
- Max width of 24rem (384px)
- Full height and responsive design