Basic Alerts

Primary Alert
This is a primary alert message.
Success Alert
Operation completed successfully!
Warning Alert
Please review your input.
Error Alert
Something went wrong.
Info Alert
Here is some information.

Alerts with Icons

Success
Your changes have been saved.
Warning
Your session will expire soon.
Error
Failed to process your request.
Info
New features are available.

Alerts without Title

Operation completed successfully!
Please review your input before submitting.
An error occurred. Please try again.

Alerts with Slots

Custom Title
This alert uses slots for custom content.
Warning
Custom message with HTML content.

Alert Component

A flexible alert component for displaying important messages to users. Supports multiple variants, icons, and custom content via slots.

Props

  • variant - string|null - 'primary' | 'success' | 'warning' | 'error' | 'info' (default: 'primary')
  • icon - string|null - FontAwesome icon name (e.g., 'check-circle', 'exclamation-triangle')
  • title - string|null - Alert title text
  • message - string|null - Alert message text

Slots

  • title - Custom title content (overrides title prop)
  • message - Custom message content (overrides message prop)
  • default - Default slot (used when no message prop or slot provided)

Variants

  • primary - Uses accent color from theme
  • success - Green color scheme
  • warning - Yellow color scheme
  • error - Red color scheme
  • info - Sky/blue color scheme

Features

  • • Multiple color variants
  • • Optional icon support
  • • Title and message props
  • • Slot-based content for flexibility
  • • HTML content support in slots
  • • Dark mode support
  • • Responsive design

Common Use Cases

Basic Alert:

<x-alert variant="success" title="Success" message="Operation completed!" />

With Icon:

<x-alert variant="error" icon="times-circle" title="Error" message="Something went wrong." />

Using Slots:

<x-alert variant="warning">
    <x-slot:title>Warning</x-slot:title>
    Custom message with <strong>HTML</strong>.
</x-alert>

Simple Message:

<x-alert variant="info" message="Here is some information." />