shadcn.io is not affiliated with official shadcn/ui
Alert examples · Info
Info with Title Alert for React
An info alert with only a title, for a message that needs no explanation.
Not every notice needs context; sometimes the reader just needs a heads-up. This React alert sets variant="info" on Alert and holds a single AlertTitle, so it reads as neutral information with a blue tint and no urgency. Use it for an FYI that explains itself, such as a feature being in beta or a scheduled update.
Preview
Installation
FAQ
When should I use a title-only info alert?
When the title is the whole message. This demo is variant="info" with a single AlertTitle and nothing else. Add AlertDescription when the reader still needs what the notice means.
When should I use info alerts vs warning alerts?
Info is for something worth knowing that carries no risk: a new feature, a beta label, a scheduled change. Warning is for something that may cause a problem if ignored, such as an expiring plan. If nothing bad happens when the reader skips it, it's info.
Where do the blue tint and border come from?
From variant="info": it gives the alert a faint tint of the theme's --info color, a stronger border in the same color, and colors any icon. The title keeps the regular text color, so it stays easy to read in light and dark mode.
Should info alerts be dismissible?
Often, yes: information the reader has seen can go. The Alert has no built-in close button, so keep whether it's shown in your own state and put a Dismiss button in AlertAction.
Related
- Info with Title and Description AlertAn info alert with a title and a
- Warning with Title AlertA warning 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
- Info with Everything AlertAn info alert with an info icon, a title
- Info with Title and Action AlertAn info alert with a title and Learn More