Drawer
Display content in a separate view from the existing context.
Best Practices
When to use
- Drawer renders as a bottom sheet on small viewports only. On desktop render Modal (or Sheet for lateral context) directly instead of forcing Drawer.
- Don’t use Drawer to confirm destructive actions. The lack of a fully blocking dim weakens the severity signal that delete and revoke flows need; route to Modal.
- A Drawer is good for short focused mobile actions: a single form, a filter sheet, a primary CTA paired with
Cancel.
Behavior
- Tap-outside and swipe-down dismiss by default; preserve both unless the form has dirty input.
- Use
verticalScrollso the drawer body scrolls inside its frame instead of the page behind it. - Cap content height with
customHeightonly when the default height clips the primary action; the action andCancelmust stay above the fold.
Content
DrawerTitleis a Title Case statement that names the entity (Deployment Details,Filter Logs).- Body is sentence case prose. One primary
Verb + Nounbutton and a literalCancel; don’t cram a destructive cascade copy into the smaller frame. - Don’t restate the page heading as the drawer title; name what this view does.
Accessibility
- Trap focus inside the drawer while open and return focus to the trigger on close.
- Escape closes the drawer; honor the system back gesture on mobile so users can dismiss without reaching for the close affordance.
- Lock body scroll on open and restore it on close so iOS rubber-band scroll doesn’t leak through.
Was this helpful?