Drawer
Drawer provides swipeable edge panels for mobile menus, contextual details, and gesture-driven flows.
Purpose
Drawer provides swipeable edge panels for mobile menus, contextual details, and gesture-driven flows. Use Sheet for dialog-style form and save/cancel flows.
Context drawer
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/drawerImport
import { Drawer, DrawerCreateHandle, DrawerPanel, DrawerPopup, DrawerSwipeArea, DrawerTrigger } from "@/components/ui/drawer";Need the machine-readable source metadata? View registry JSON.
Usage
Use Drawer for contextual panels and mobile edge interactions. Use Sheet for direct edit forms.
import { Drawer, DrawerPopup, DrawerTrigger } from "@/components/ui/drawer";
import { Button } from "@/components/ui/button";
export function Example() {
return (
<Drawer>
<DrawerTrigger render={<Button variant="outline" />}>Open details</DrawerTrigger>
<DrawerPopup>...</DrawerPopup>
</Drawer>
);
}Examples
Positions, popup variants, drag affordances, snap points, nesting and the drawer menu system are props and compositions of the same primitive.
Positions
The position prop attaches the drawer to any viewport edge. The swipe direction follows automatically.
Popup variants
default keeps the rounded edge, straight sits flush with the viewport, inset floats as a rounded panel on larger screens.
Close button and bar
Both affordances are opt-in: showCloseButton renders a corner close action, showBar renders the drag handle.
Scrollable content
DrawerPanel wraps its content in a ScrollArea, so header and footer stay visible.
Snap points
snapPoints, snapPoint and onSnapPointChange pass through to the drawer root.
Nested drawers
A drawer inside an open drawer keeps the native stack and swipe animation.
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
positionplaces the Drawer at an edge.swipeDirectionnormally follows that position but may override the gesture direction.DrawerSwipeArea positioncreates a fixed edge target that can open the Drawer with a swipe.DrawerCreateHandlesupports detached triggers and imperative opening.DrawerPanel scrollable={false}removes the ScrollArea wrapper;scrollFade={false}keeps scroll edges hard instead of faded.allowSelectionon Header, Footer, and Panel chooses selectable content behavior instead of a drag surface.- Drawer menu items, checkbox items, and radio items accept
disabled. variant="straight"and inset variants define the native surface shape; do not recreate them with local classes.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Popup, backdrop, stacking, snap points, and swipe progress are native Drawer behavior.
- Do not copy Sheet motion onto Drawer or wrap the popup in another transform.
- Interactive triggers and menu items use a pointer cursor. Drag and selectable content surfaces keep their appropriate default or text cursor.
Accessibility
- Give every Drawer a
DrawerTitleandDrawerDescription, visually hidden when the visible design already supplies equivalent context. - Preserve Escape, focus restoration, and modal behavior where configured.
- Disabled menu items must be unavailable and visibly distinct.
- Keep text selection enabled for content users may need to copy.
Implementation Guidance
- Use Drawer for edge and gesture flows; use Sheet for form-oriented flyouts.
- Choose position, swipe area, scroll, selection, and disabled props through the public API instead of local overrides.
- Preserve native gesture, stack, focus, cursor, and motion behavior.