Drawer
Side panel for navigation or secondary tasks over the page.
Installation
pnpm dlx shadcn@latest add @paneui/drawerUsage
Composition
Examples
Motion
The panel exits on a stiffer spring than it enters. With reduced motion the panel and backdrop only fade.
Keyboard
Focus moves into the drawer and is trapped there; Esc or a backdrop press closes it.
API Reference
Built on the Dialog primitive. Only the props this library adds or changes are listed; everything else passes through.
Drawer
Root. Holds the open state and the side. Also accepts every prop of Dialog.Root.
- side= "right"
- "left" | "right"
- Edge the panel slides in from.
- open
- boolean
- Controlled open state.
- defaultOpen= false
- boolean
- Open on first render.
- onOpenChange
- (open: boolean, details) => void
- Called when the drawer opens or closes.
| Prop | Type | Default | Description |
|---|---|---|---|
| side | "left" | "right" | "right" | Edge the panel slides in from. |
| open | boolean | — | Controlled open state. |
| defaultOpen | boolean | false | Open on first render. |
| onOpenChange | (open: boolean, details) => void | — | Called when the drawer opens or closes. |
DrawerTrigger
Also accepts every prop of Dialog.Trigger.
DrawerContent
The floating panel (up to 384px wide, 8px from the edges) with its backdrop and portal. Also accepts every prop of Dialog.Popup.
- showClose= true
- boolean
- Show the round × button in the top-right corner.
| Prop | Type | Default | Description |
|---|---|---|---|
| showClose | boolean | true | Show the round × button in the top-right corner. |
- data-side
leftorright.
| Data attribute | Description |
|---|---|
| data-side | left or right. |
DrawerHeader
Padded top area; leaves room on the right for the close button. Also accepts every prop of div.
DrawerTitle
Also accepts every prop of Dialog.Title.
DrawerDescription
Also accepts every prop of Dialog.Description.
DrawerClose
Also accepts every prop of Dialog.Close.