shadcn.io is not affiliated with official shadcn/ui
Alert Dialog examples · Informational
Information with Centered Icon Alert Dialog for React
An informational dialog with a centered lightbulb icon and a keyboard shortcut in its text.
A good tip deserves a moment of attention. This React alert dialog centers a lightbulb in a tinted circle above a Pro Tip that teaches a keyboard shortcut. It's shadcn.io's Alert Dialog on Base UI with the shortcut set in a Kbd.
Preview
Installation
FAQ
When should the icon be centered?
For messages worth pausing on: tips, milestones, announcements. Routine information reads faster with the icon beside the title.
Which colors suit a tip?
bg-warning/10 behind a text-warning icon, the theme's amber. Use info for general notes and success for completions; the tokens adapt to dark mode.
What size should the circle be?
size-12 with a size-6 icon inside, so the icon is half the circle's width.
How is the shortcut shown?
With the Kbd component inside AlertDialogDescription, which styles Cmd+K as a key and renders a kbd element.
Should the description be centered too?
Yes, AlertDialogHeader centers everything with sm:place-items-center sm:text-center. For long text, start-align it instead.
How often should tips appear?
Once per tip per person. Remember which tips were dismissed, and show each when it's relevant, not on every visit. On Base UI, AlertDialogAction is a plain button: control open and close the dialog in its handler, or use AlertDialogCancel for a button that only dismisses.
Related
- Information with Icon Alert DialogAn informational dialog with an info icon
- Simple Information Alert Alert DialogA simple informational dialog with one OK
- Success with Multiple Actions Alert DialogA success dialog with Close and a
- Information with Status Badge Alert DialogAn informational dialog with a status
- Standard DialogA share dialog with a read-only link, a
- Information with Action Button Alert DialogAn informational dialog with a bell icon