Skip to content
shadcn.io

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.

Framework
UI library

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

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

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.

Are neutral-colored alerts accessible?

Yes: the meaning is in the text, not the color, and the default variant keeps the theme's foreground on the card background. Alert also renders with role="alert"; for a message that isn't urgent, pass role="status" for a polite announcement.

Should standard alerts be dismissible?

If the reader has nothing left to do with the message, yes. The Alert has no built-in close button: keep its visibility in your own state and put a Dismiss button in AlertAction.