Skip to main content

Storybook

Alert

Displays a contextual feedback message in response to a user action or system event. Use to communicate success, errors, warnings, or informational updates inline.

Figma Storybook Docs

Description

What it does

Alert communicates a system state, feedback message, or important notice to the user. It appears inline within page content, not as a modal overlay.

Where it appears

Form feedback, page-level notifications, system status banners, upload results, and confirmation of completed actions. It sits within the document flow, not above it.

Why it exists

Consistent alert treatment means users can quickly identify and interpret feedback without re-learning each screen. The four semantic variants — success, error, warning, info — carry predictable meaning across the product.

Dependencies

For messages requiring a user decision, use Modal. For transient messages that appear and disappear automatically, use the toast pattern (separate component). Alert is for persistent or semi-persistent inline messages.

Anatomy

PartRequired?Notes
Icon Recommended 20×20px icon reinforcing the semantic variant. Never the only signal — always pair with colour and text.
Title Optional Short headline. Use when the message benefits from a scannable label. Omit for brief single-sentence messages.
Body text Required The message. Plain language. One clear idea per alert.
Action link Optional A single inline action relevant to the message. Use sparingly.
Dismiss button Optional × button for closeable alerts. Only include when dismissal is genuinely appropriate for the context.

Variants

Your changes have been saved.

Success

Positive outcome

Confirming a completed action: saved, submitted, sent, created. Be specific — tell the user exactly what succeeded.

This action is permanent and cannot be undone.

Danger

Something went wrong

An action failed, a system error occurred, or validation cannot proceed. Explain what went wrong and what the user can do. Never blame the user.

You have unsaved changes. Please review before continuing.

Warning

Potential issue or risk

Something is unusual or may cause a problem, but hasn't yet. Used for time-sensitive situations, impending expiry, or partial failures.

This feature is currently in beta. Some options may change.

Brand

Neutral information

Contextual information that helps the user but doesn't signal a problem or outcome. "This consultation closes in 3 days."

No changes have been made to this record.

Neutral

System or contextual notice

Passive system information with no urgency or status implication. Use when the message is contextual rather than responsive to a user action.

States

State Behaviour
Default (open) Visible in document flow. Announced to screen readers via ARIA live region.
Dismissible Has a close button. On dismiss: removed from DOM or hidden via the hidden attribute. Dismissal can be animated if prefers-reduced-motion allows.
Loading Some system alerts appear while an operation is in progress. Use role="status" for these — not role="alert" (see Accessibility tab).

Usage guidelines

When to use

  • Confirming the result of an action: form submission, file upload, save operation.
  • Communicating a system error that the user needs to know about.
  • Flagging a condition that may affect the user's next steps.
  • Providing context about a page or feature state.

When not to use

  • When the message requires a user decision — use a Modal.
  • For messages that should disappear automatically — use a toast notification.
  • For field-level validation — use inline error messages on the form field instead.
  • As a container for complex content or interactive UI — keep alert content short and focused.

Do / Don't

Do

Be specific in success messages: "Consultation saved" rather than "Success". Tell users exactly what happened.

Don't

Don't use alarming language in error messages. "Something went wrong — please try again" is better than "Critical error — operation failed".

Do

Use icon + colour + text together. Colour alone isn't enough — users who can't distinguish red from green still need to understand the message.

Don't

Don't stack multiple alerts of the same type. Consolidate messages into one alert with a list if multiple issues exist.

Do

Use role="alert" for urgent messages (errors) and role="status" for non-urgent ones (success, info). See the Accessibility tab.

Don't

Don't include dismiss buttons on error alerts unless the error has been resolved. Dismissing an unresolved error creates confusion.

Was this page helpful?

Updated 10 September 2026