shadcn.io is not affiliated with official shadcn/ui
Alert Dialog examples · Confirmation
Confirmation with Centered Icon Alert Dialog for React
A confirmation dialog with a large icon in a tinted circle centered above the title.
Some decisions deserve a moment of ceremony. This React alert dialog centers a help icon in a tinted circle above the title, so a permission request or an opt-in reads as more than a routine yes or no. It's built from shadcn.io's Alert Dialog on Base UI, with the circle and the centered header as plain Tailwind classes.
Preview
Installation
FAQ
When should I center the icon instead of putting it beside the title?
Center it for moments you want the reader to slow down on: permission requests, opt-ins, announcements. For routine confirmations an icon beside the title is quicker to scan, as in Confirmation with Icon.
How is the header centered?
AlertDialogHeader takes sm:place-items-center sm:text-center, so the circle, the title and the description line up in the middle from the sm breakpoint. Center everything in the header together; a centered icon over start-aligned text looks unfinished.
What size should the circle and icon be?
A size-12 circle around a size-6 icon keeps a 2:1 ratio that leaves even padding. A larger circle crowds small screens, a smaller one loses the emphasis.
Which colors should the circle use?
Use the theme's status tokens: bg-info/10 with text-info here, bg-success/10 and text-success for success, bg-warning/10 and text-warning for tips, bg-destructive/10 and text-destructive for danger. They follow light and dark mode with no dark: overrides.
Related
- Confirmation with Icon Alert DialogA confirmation dialog with a warning icon
- Success with Icon Alert DialogA success dialog with a check icon beside
- Delete Confirmation with Icon Alert DialogA delete confirmation with a trash icon
- Information with Icon Alert DialogAn informational dialog with an info icon
- Standard DialogA share dialog with a read-only link, a
- Simple Confirmation Dialog Alert DialogA simple confirmation dialog with Cancel