Skip to content
shadcn.io

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.

Framework
UI library

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

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 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.

What else is set on this alert?

className="max-w-lg" caps the width. The title text is Info, in an AlertTitle, which is font-medium. There is no icon, so the alert does not add an icon column.

Are info alerts accessible to screen readers?

Alert renders with role="alert", which interrupts the reader to announce it. That's too urgent for most information: pass role="status" for a polite announcement, or remove the role when the alert is on the page from the start.