InlineAlert

A messaging component that displays contextual information with optional title, body text, and dismissal functionality. Supports four semantic variants with trauma-informed messaging principles.

Variants

Info (default)

Info alert

Information

This is an informational message to help you understand the current situation.

Success

Success alert

Success

Your action has been completed successfully. You're all set!

Warning

Warning alert

Important Notice

Please review this information carefully before proceeding. Your attention is needed.

Error

Title Only

Info alert

Quick update available

Success alert

Profile updated successfully

Body Only (Slot)

Info alert
This alert uses the default slot for body content without a title.
Warning alert
Your session will expire in 5 minutes. Please save your work.

Dismissable

Info alert

Dismissable Info

Click the close button to dismiss this alert. It will animate out smoothly.
Success alert

Dismissable Success

This success message can be dismissed when you're done reading it.
Warning alert

Dismissable Warning

Important warnings can also be dismissed after acknowledgment.

Trauma-Informed Messaging

Examples demonstrating empowering, non-alarming language that respects user agency.

Info alert

Zika Risk Information Available

We have updated risk information for your area. You can review it at your convenience to make informed decisions about your health.
Warning alert

Consider Protective Measures

Based on current conditions, you may want to consider using mosquito repellent. This is a suggestion to help you stay comfortable and protected.
Success alert

Your Preferences Saved

Your notification preferences have been updated. You're in control of what information you receive and when.

Rich Content (Slot)

Info alert

Multiple Paragraphs

The slot allows for rich content including multiple paragraphs, lists, and formatted text.

This provides flexibility for more complex messaging needs while maintaining consistent styling.

  • Support for lists
  • Multiple content blocks
  • Flexible formatting

Accessibility Features

ARIA Roles:

  • Error variant uses role="alert" with aria-live="assertive"
  • Other variants use role="status" with aria-live="polite"

Icon Accessibility:

  • Icons include descriptive titles for screen readers
  • Semantic color coding with sufficient contrast ratios

Dismissable Alerts:

  • Close button has clear aria-label
  • Smooth transitions with Alpine.js
  • Keyboard accessible

Usage Example


Info alert

Information

This is an informational message.
Warning alert

Important Notice

Custom content using the slot for more flexibility.

Props

Prop Type Default Description
variant string 'info' Alert variant: info, success, warning, error
title string|null null Optional alert title
body string|null null Optional alert body text (alternative to slot)
dismissable boolean false Show close button for dismissal
class string '' Additional CSS classes