| title | Drawer |
|---|---|
| description | A panel that slides in from the edge of the screen with swipe-to-dismiss gestures. |
| source | packages/raystack/components/drawer |
import { playground, basicDemo, positionDemo } from "./demo.ts";
Import and assemble the component:
import { Drawer } from "@raystack/apsara";
<Drawer side="right">
<Drawer.Content>
<Drawer.Header>
<Drawer.Title />
<Drawer.Description />
</Drawer.Header>
<Drawer.Body />
<Drawer.Footer />
</Drawer.Content>
</Drawer>Groups all parts of the drawer. The side prop determines both the slide direction and the swipe-to-dismiss direction.
Renders the drawer panel that slides in from a screen edge.
children: React.ReactNode - Content to render inside the headerclassName: string - Additional CSS class name
- Inherits all Base UI Drawer.Title props
- Inherits all Base UI Drawer.Description props
- Inherits all HTML div element props
- Inherits all HTML div element props
The Drawer can slide in from different sides of the screen. Swipe-to-dismiss is automatically configured based on the side prop.
- Uses
role="dialog"witharia-modal="true" - Focus is trapped within the drawer and restored on close
- Supports dismissal with Escape key and swipe gestures
- Title is announced via
aria-labelledby - Respects motion preferences: drawer slide motion is enabled only when
prefers-reduced-motion: no-preference