Alert

A prominent message component used to communicate important information to users, with support for multiple variants and actions.

Variants

With Title

Dismissible

With Action Buttons

Dismissible with Actions

Props

NameTypeDefaultDescription
variant'success' | 'error' | 'warning' | 'info''info'Visual style variant of the alert
titlestring-Optional alert title
description*string-Alert message content
dismissiblebooleanfalseWhether the alert can be dismissed
onDismiss() => void-Callback function when alert is dismissed
actionsArray<{label: string, onClick: () => void}>-Action buttons to display in the alert

Usage Guidelines

When to use

  • For important messages that require user attention or action
  • To communicate system status, errors, warnings, or confirmations
  • When providing contextual information within a workflow
  • For non-intrusive notifications that don't require immediate action

Best practices

  • Use appropriate variant: success for confirmations, error for critical issues, warning for caution, info for general updates
  • Keep messages concise and action-oriented
  • Provide clear next steps through action buttons when needed
  • Make alerts dismissible when they are informational and not critical
  • Avoid showing multiple alerts at once - prioritize and consolidate

Accessibility

  • Uses ARIA role="alert" for screen reader announcements
  • Icons provide visual reinforcement, not sole information source
  • Action buttons are keyboard accessible (Tab, Enter/Space)
  • Dismiss button includes aria-label for screen readers
  • Color is not the only indicator - icons and text convey meaning

Do's and Don'ts

Do

  • Use clear, specific messages that explain what happened
  • Match variant to message severity (error for failures, success for confirmations)
  • Provide actionable next steps through buttons
  • Use dismissible alerts for non-critical information

Don't

  • Don't use vague messages like "Something went wrong"
  • Don't mismatch variant and message (error variant with positive message)
  • Don't show critical errors as dismissible
  • Don't use alerts for promotional content or marketing

Related Components

Resources