shadcn.io is not affiliated with official shadcn/ui
Alert examples · Standard
Standard with Everything Alert for React
A neutral alert with a check icon, a title, a description, and View Details and Dismiss buttons.
This is the full neutral alert: a CircleCheckIcon from Lucide, a title, a description, and View Details and Dismiss buttons, in the default Alert with no color tint. The icon goes first and the alert gives it its own column in the text color, so the title and description line up beside it. Use it for prominent general announcements that should stand out without a semantic color.
Preview
Installation
FAQ
Which icon does this alert use, and why isn't it green?
CircleCheckIcon, with aria-hidden="true", next to a title that says Success. There is no variant, so the icon takes the alert's text color. variant="success" is what tints the border and paints the icon with --success.
Should standard alert icons use color or stay neutral?
Neutral fits the default variant: the icon takes the alert's text color, so nothing suggests an error or a success. If the icon needs a color, switch to the variant that matches it instead of coloring the icon alone.
How does the icon line up with the title?
Put it first, before AlertTitle: the alert places a direct svg child in its own column, spanning the title and description, aligns it with the title's first line, and sizes it unless you pass a size class.
How are View Details and Dismiss set up?
Both are size="xs" inside one AlertAction with className="flex gap-2". View Details is the default button. Dismiss is variant="outline". Neither has a click handler.
Related
- Standard with Title, Description and Action AlertA neutral alert with a title, a
- Standard with Title AlertA neutral alert with only a title, for a
- Info with Everything AlertAn info alert with an info icon, a title
- Success with Everything AlertA success alert with a check icon, a
- Error with Everything AlertA destructive alert with an error icon, a
- Standard with Title and Action AlertA neutral alert with a title and View