Skip to content

Alert

Contextual feedback messages for user actions and system status.

Variants

Info, success, warning, and error alert styles.

Dismissible

Alert that can be dismissed by the user.

Without Title

Alerts with body text only, no title.

Sizes

Three sizes for different density contexts.

PropTypeDefaultDescription
variant"info" | "success" | "warning" | "error""info"The visual style of the alert.
size"sm" | "md" | "lg""md"Controls padding and icon size.
titlestringOptional title displayed above the alert body.
dismissiblebooleanfalseWhether the alert can be dismissed.
onDismiss() => voidCallback fired when the dismiss button is clicked.
iconReactNodeOverride the default variant icon.
visiblebooleantrueControls visibility with AnimatePresence exit animation.
childrenReactNodeThe alert body content.

Related Components

Best Practices

✅ Do

  • Use appropriate variants (success/warning/error/info)
  • Keep messages concise
  • Provide actionable guidance in error alerts
  • Place alerts near the relevant context

❌ Don't

  • Use alerts for permanent content
  • Stack more than 3 alerts
  • Use error variant for warnings
  • Dismiss important alerts automatically

Accessibility

FeatureSupport
role="alert"Applied for important messages
aria-live="polite" / "assertive"Controls announcement priority for screen readers
Screen reader announcementAlert content is announced when it appears
Not auto-dismissed for errorsError alerts persist until user action