Skip to content

Alert

Free

A message in the page with an icon, a title, and text. It tells people about a status, such as a failed payment, and stays until the cause goes away.

  • React 19
  • Tailwind CSS 4

Added Nov 8, 2026 · MIT + Commons Clause

Playground

Loading the preview

Props

Put the icon first, then AlertTitle and AlertDescription. The alert has role="alert", so pass role="status" for a message that is not urgent.

The sample also uses Button. One command adds them with this item:

payment-alert.tsx

Alert

<div>
PropTypeDefaultDescription
variant"default""destructive""info""success""warning""default"
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AlertTitle

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AlertDescription

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.

AlertAction

<div>
PropTypeDefaultDescription
...props<div> attributes—Every other attribute goes to the <div>, with a ref.
  • Use it for a message that stays in the page until the cause goes away.
  • Put the icon first, then AlertTitle, then AlertDescription. Each part is optional.
  • Use success, warning, or info for a status. Put the inverse class on an alert that must stand out from the page.
  • It has role="alert", so a screen reader reads it at once. For a message that is not urgent, pass role="status".
  • For a short note after an action that closes on its own, use a Toast.
  • To ask a yes or no question before an action, use an Alert Dialog.

Alert is a <div> with role="alert". A screen reader reads it at once when it shows, and stops what it reads. Pass role="status" for a message that is not urgent: the screen reader waits until the user is idle. Pass role="none" for a note that is in the page from the start.

The variant changes only colors. Put the meaning in the words of AlertTitle and AlertDescription, so the message does not depend on color.

The alert takes no focus and does not close on its own. A Button in AlertAction stays in the normal tab order.

  1. AddedAlert.
Open the release