shadcn.io is not affiliated with official shadcn/ui
Alert examples · Standard
Standard with Title Alert for React
A neutral alert with only a title, for a message that needs no explanation.
Sometimes an alert shouldn't carry a color at all. This React alert is a plain Alert with no variant, holding a single AlertTitle: the default style, on the card background with a border, without the destructive, info, success or warning tints. Use it for general messages that don't fit those categories, where a color would suggest an urgency that isn't there.
Preview
Installation
FAQ
When should I use standard alerts vs colored variants?
Use the default when the message is neither good nor bad news, or when the page already has colored alerts and this one shouldn't compete. Reach for destructive, warning, success or info when the category matters to the reader.
What's the difference between standard and info alerts?
Only the look: variant="info" adds a blue tint, a blue border and a blue icon, which marks the message as information. The default variant has the card's background and the regular border, so it reads as part of the page.
Can I customize standard alert colors?
Yes: pass classes on Alert, such as a background and a border color, as the Alert page's Colors demo does. Use the theme's tokens rather than raw palette colors so the alert follows light and dark mode, and prefer a built-in variant when one fits.
What does this demo actually render?
An Alert with no variant and className="max-w-lg", holding one AlertTitle whose text is Success. There is no icon, description, or AlertAction.
Related
- Standard with Title and Description AlertA neutral alert with a title and a
- Info with Title AlertAn info alert with only a title, for a
- Success with Title AlertA success alert with only a title, for a
- Error with Title AlertA destructive alert with only a title
- Warning with Title AlertA warning alert with only a title, for a
- Standard with Everything AlertA neutral alert with a check icon, a