shadcn.io is not affiliated with official shadcn/ui
Alert Dialog examples · Confirmation
Confirmation with Icon Alert Dialog for React
A confirmation dialog with a warning icon beside the title.
An icon signals the tone of a dialog before anyone reads it. This React alert dialog puts an amber alert icon beside the title of an unsaved-changes warning. It's shadcn.io's Alert Dialog on Base UI, with the icon and AlertDialogTitle side by side in a small flex row.
Preview
Installation
FAQ
Which color should the icon use?
Match the message: text-warning for caution as here, text-destructive for destructive actions, text-success for success and text-info for information. These theme tokens adapt to dark mode on their own.
Should the icon go before or after the title?
Before it, in a flex items-center gap-2 row, so it's seen first. Put it above the title, centered, for a more dramatic dialog, as in Confirmation with Centered Icon.
What size works beside the title?
size-5 sits well next to the title text. Go to size-6 for a stronger warning; at size-4 the icon reads as decoration.
Do screen readers announce the icon?
No, it's aria-hidden. The title and description carry the message, so never rely on the icon alone to say something the text doesn't.
Related
- Simple Confirmation Dialog Alert DialogA simple confirmation dialog with Cancel
- Delete Confirmation with Icon Alert DialogA delete confirmation with a trash icon
- Success with Icon Alert DialogA success dialog with a check icon beside
- Information with Icon Alert DialogAn informational dialog with an info icon
- Confirmation with Detailed Description Alert DialogA confirmation dialog that lists every
- Standard with Title AlertA neutral alert with only a title, for a