Components · Feedback · Alert
Back to Alert typesAlert
Use for surfacing a status message inline within page content, like "Your changes have been saved." - one Alert component, controlled by properties, not a one-off banner built from scratch each time.
Properties
Corner radius, title, description, icon and action label are properties of the same component, not separate banners - change them below to check this alert's types and scenarios in the Live Preview. Dismissible, With action and Loading aren't separate properties here since they're not mutually exclusive states - pick any row by name from the Live Preview's own State selector to see that combination (e.g. Dismissible + With action together).
Live Preview
All 4 types compared side by side, each across 5 representative scenarios - Default, Dismissible, With action, Dismissible + With action (proving the two combine), and Loading. One full matrix is rendered per selected Corner radius, with the current title, description, icon and action-label settings applied throughout.
When to use
Any inline status message that needs to sit flush in the page's content flow, not float above it like a Toast.
Component Guide
Overview
Alert surfaces a status message inline within page content, like "Your changes have been saved." - it sits flush in the normal page flow, full width of its container, unlike Toast which floats above the page in a fixed corner.
When to Use
- A save or action confirmation embedded in the page - "Your changes have been saved."
- System status or a maintenance notice - a persistent banner that stays until dismissed or resolved.
- A form-level validation summary - listing every error at the top of a form.
When Not to Use
- A temporary confirmation that shouldn't require the user to stay on the page - use Toast, which floats and self-dismisses.
- A message that must block interaction until acknowledged - use Modal - Alert never interrupts the page, it just sits within it.
- A short hint tied to a specific control - use Tooltip instead of a full-width banner for a small, localized hint.
Best Practices
- Match the type (info/success/warning/error) to the actual severity - overusing error styling for minor notices trains users to ignore it.
- Keep the message specific and actionable ("Your card expired - update payment details"), not a vague "Something happened."
- Only make it dismissible when the information genuinely stops being relevant after being read once.
Do and Don't
Do
Names what happened and what to do about it, so the message is actionable on its own.
Don't
Tells the user only that they are stuck. With no cause and no next step, the alert costs attention and returns nothing.
Accessibility
- role="alert" is not universal here - it belongs only on an Alert that is dynamically inserted in response to something, such as "3 validation errors" appearing after a failed form submit, where the assertive announcement is the point. The Alert shown in the Live Preview and in the Do/Don't demos above is static markup, present when the page renders rather than injected afterward, so it intentionally carries no role="alert" here - adding one would fire a disruptive assistive-technology announcement every time the page loads, which is a real anti-pattern, not a safe default to copy onto every Alert.
- When an Alert genuinely is inserted dynamically, use role="alert" (assertive) for errors that need immediate attention, or role="status" (polite) for a lower-urgency dynamic update - and apply it in code at the point of insertion, not as a permanent attribute on a banner that's simply always there.
- Type is communicated by an icon and text, not color alone, for users with color-vision deficiencies.
- The dismiss control (when present) has an accessible name ("Dismiss this alert"), not just an X icon.
Related Components
Toast, Notification, Result.
{
"component": "Alert",
"category": "Feedback",
"summary": "Alert surfaces a status message inline within page content, like \"Your changes have been saved.\" - it sits flush in the normal page flow, full width of its container, unlike Toast which floats above the page in a fixed corner.",
"whenToUse": [
"A save or action confirmation embedded in the page - \"Your changes have been saved.\"",
"System status or a maintenance notice - a persistent banner that stays until dismissed or resolved.",
"A form-level validation summary - listing every error at the top of a form."
],
"whenNotToUse": [
"A temporary confirmation that shouldn't require the user to stay on the page - use Toast, which floats and self-dismisses.",
"A message that must block interaction until acknowledged - use Modal - Alert never interrupts the page, it just sits within it.",
"A short hint tied to a specific control - use Tooltip instead of a full-width banner for a small, localized hint."
],
"bestPractices": [
"Match the type (info/success/warning/error) to the actual severity - overusing error styling for minor notices trains users to ignore it.",
"Keep the message specific and actionable (\"Your card expired - update payment details\"), not a vague \"Something happened.\"",
"Only make it dismissible when the information genuinely stops being relevant after being read once."
],
"doAndDont": {
"do": "Names what happened and what to do about it, so the message is actionable on its own.",
"dont": "Tells the user only that they are stuck. With no cause and no next step, the alert costs attention and returns nothing."
},
"accessibility": [
"role=\"alert\" is not universal here - it belongs only on an Alert that is dynamically inserted in response to something, such as \"3 validation errors\" appearing after a failed form submit, where the assertive announcement is the point. The Alert shown in this page's Live Preview and Do/Don't demos is static markup, present when the page renders rather than injected afterward, so it intentionally carries no role=\"alert\" - adding one would fire a disruptive assistive-technology announcement every time the page loads, which is a real anti-pattern, not a safe default to copy onto every Alert.",
"When an Alert genuinely is inserted dynamically, use role=\"alert\" (assertive) for errors that need immediate attention, or role=\"status\" (polite) for a lower-urgency dynamic update - applied in code at the point of insertion, not as a permanent attribute on a banner that's simply always there.",
"Type is communicated by an icon and text, not color alone, for users with color-vision deficiencies.",
"The dismiss control (when present) has an accessible name (\"Dismiss this alert\"), not just an X icon."
],
"relatedComponents": [
"Toast",
"Notification",
"Result"
]
}