Drawer

Side panel for navigation or secondary tasks over the page.

Installation

pnpm dlx shadcn@latest add @paneui/drawer

Usage

Composition

Examples

Navigation

Controlled

Without Close Button

Scrolling Body

RTL

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.
PropTypeDefaultDescription
side"left" | "right""right"Edge the panel slides in from.
openboolean—Controlled open state.
defaultOpenbooleanfalseOpen 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.
PropTypeDefaultDescription
showClosebooleantrueShow the round × button in the top-right corner.
data-side
left or right.
Data attributeDescription
data-sideleft or right.

DrawerHeader

Padded top area; leaves room on the right for the close button. Also accepts every prop of div.

DrawerBody

The scrolling area (overscroll-contain). Also accepts every prop of div.

DrawerFooter

Action row pinned to the bottom of the panel. 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.