shadcn/ui Alert Dialog vs Dialog
Use an Alert Dialog when the user must make a decision, like confirming a delete. Use a Dialog for everything else, like forms, details, or settings. An Alert Dialog does not close when you click outside it and uses the alertdialog role, while a regular Dialog does close on an outside click.
Side by side
| Alert Dialog | Dialog | |
|---|---|---|
| Purpose | Interrupt and ask for a decision | Show content or a form |
| ARIA role | alertdialog | dialog |
| Click outside | Does not close | Closes |
| Escape key | Closes | Closes |
| Modal | Always | Usually, can be non-modal with Base UI |
When to use which
- Deleting data, discarding changes, or signing out: Alert Dialog with clear Cancel and Continue actions.
- Editing a profile, creating an item, or viewing details: Dialog.
- Do not use an Alert Dialog for success messages. Use a toast instead.
Ready-made examples
Browse dialog components and alert components you can install with the shadcn CLI.