Drawer
Drawer presents a supporting task or detail from the page edge, preserving context while providing a larger temporary workspace.
Usage
Include CSS
Import Tailwind and one full A3S UI style bundle.
Or import only the base CSS, Drawer component CSS, and one style pack.
Using CDN or bundler imports? See the Installation page.
Include JavaScript
Copy or serve the full A3S UI JavaScript bundle.
Or copy or serve the A3S UI runtime and Drawer script.
Using CDN or bundler imports? See the Installation page.
Add your drawer HTML
A3S UI maps shadcn/ui's Vaul Drawer to a native <dialog> element. This keeps modality, focus handling, and inert page content in the browser platform. The Drawer script adds safe backdrop-click close and lets the exit animation finish before calling the native close. Drag gestures, snap points, and the drag handle are intentionally not included.
HTML structure
<button type="button" onclick="drawer.showModal()">Optional- Trigger button. A3S UI intentionally uses the native
HTMLDialogElement.showModal()method. <dialog class="drawer" data-side="bottom|top|left|right">Native modal drawer. Omit
data-sidefor the default bottom drawer. Addaria-labelledbyandaria-describedbywhen title and description are present. JavaScript adds thedata-drawer-initializedflag and manages animated close behavior.<article>Drawer content surface.
<header>Optional- Drawer header with a title and optional description.
<section>Optional- Scrollable body/content area.
<footer>Optional- Action area pinned after the drawer body.
JavaScript API
React useDrawer and the equivalent Vue composable expose native showModal() and the enhanced close(returnValue). close() waits for an exit transition no longer than 220ms and completes immediately under reduced motion.
Examples
Sides
Use data-side to set the viewport side. Available values are top, right, bottom, and left.
Scrollable content
Keep actions visible while the drawer body scrolls.
RTL
Drawer sides are physical viewport sides. Content spacing and text alignment follow document direction.
