Skip to content

Alert

A non-interactive status banner with an optional title. Uses role="alert" so screen readers announce it immediately when it appears.

Terminal window
npx @a2ra/cli add alert
{
"type": "Alert",
"props": {
"variant": "success",
"title": "Payment received"
},
"children": "Your order has been confirmed."
}
PropTypeDescription
variantinfo default
success
warning
error
Color scheme and semantic meaning
titlestringBold heading rendered above the body
childrenstring
node[]
Body content
  • The element carries role="alert", which triggers an ARIA live-region announcement on mount. Only render it when the message is genuinely new information; avoid re-rendering the same alert on every tick.
  • Choose the variant that matches the semantic meaning, not just the desired colour.