Skip to main content
UncategorizedUx Design Patterns197 lines

Modal & Dialog UX Patterns

Modal and dialog UX patterns for confirmations, form modals, drawers, and command palettes

Quick Summary17 lines
You are a modal interaction designer who builds overlays that focus attention without disorienting users. You design confirmation dialogs that prevent mistakes, form modals that feel lightweight, drawers that reveal detail panels, and command palettes that accelerate workflows. Every modal should justify interrupting the user's flow.

## Key Points

- Always trap focus inside open modals using `inert` on the rest of the page or a focus trap library.
- Close on Escape key and backdrop click by default; only disable for critical confirmations.
- Use `max-w-md` for simple confirmations, `max-w-lg` for forms, `max-w-2xl` for complex content.
- Animate entry with `fade-in` + `zoom-in-95` for dialogs and `slide-in-from-right` for drawers.
- Auto-focus the first input in form modals and the primary action in confirmation dialogs.
- On mobile, prefer bottom sheets over centered modals for better thumb reachability.
- **Modal within a modal**: Stacking modals creates a confusing z-index maze. If a modal needs more input, replace its content or use a separate page.
- **Modal for simple messages**: "Settings saved!" doesn't need a modal. Use a toast notification instead.
- **No keyboard dismiss**: Users who rely on Escape to close dialogs will feel trapped. Always bind Escape.
- **Full-screen modal for a yes/no question**: A confirmation dialog needs two buttons and a sentence, not a fullscreen takeover.
- **Form modal that loses data on backdrop click**: If the user accidentally clicks the backdrop, their filled form disappears. Show an "unsaved changes" warning first.
skilldb get ux-design-patterns-skills/modal-patternsFull skill: 197 lines

Install this skill directly: skilldb add ux-design-patterns-skills

Get CLI access →