Overlays
Modal
Also calleddialogdialog boxpopuppop-uplightbox
A centered window that appears on top of the page and blocks everything behind it until the person responds or dismisses it.
How people describe it
- “popup with a dark background behind it”
- “box in the middle of the screen that blocks everything else”
- “confirmation window with Cancel and OK buttons”
- “window that appears on top of the page”
Good for
- Confirming a destructive action
- Short forms that need full focus
- Showing a single important message
Don’t mix it up with
Slides in from an edge and usually holds more content.
Small and anchored to a button; the page stays usable.
Appears briefly and doesn't block anything.
What your library calls it
| LIBRARY | CALLS IT |
|---|---|
| shadcn/ui | Dialog (AlertDialog for confirmations) |
| MUI | Dialog (Modal is the low-level base) |
| Chakra UI | Dialog (v3) / Modal (v2) |
| Mantine | Modal |
| Radix UI | Dialog |
Accessibility checklist
- Trap focus while it is open
- Close on Esc
- Return focus to the trigger on close
- Give it an accessible name (aria-labelledby)
Try it
Closed · Esc or the backdrop closes it
Focus is trapped inside. Esc, the backdrop, or a button closes it and returns focus.
Settings
Colors
Pick, eyedrop, or generate a color, then choose Custom under Color above.
Passes AA · 6.9:1
Text color is chosen for you.
Start
End
Prompt
Add a centered modal with title, body, Cancel and Confirm buttons. Trap focus.
~20 estimated prompt tokensDetailed: ~58 estimated prompt tokens
Rough estimate for prompt text only; actual counts vary by model and context.
<dialog id="confirm">
<h2>Delete project?</h2>
<p>This can't be undone.</p>
<form method="dialog">
<button>Cancel</button>
<button value="confirm">Delete</button>
</form>
</dialog>
<button onclick="document.getElementById('confirm').showModal()">Delete</button>Used in
Explore website blueprints that use this component.