Alert your users with a simple message. You can add icons, change the colour and border, adjust sizing, and enable dismissible functionality.
The alert component supports 9 different variants, each with its own color scheme and styling:
<x-andach-alert>This is the <strong>default</strong> variant.</x-andach-alert>
<x-andach-alert variant="dark">This is the <strong>dark</strong> variant.</x-andach-alert>
<x-andach-alert variant="light">This is the <strong>light</strong> variant.</x-andach-alert>
<x-andach-alert variant="brand">This is the <strong>brand</strong> variant.</x-andach-alert>
<x-andach-alert variant="primary">This is the <strong>primary</strong> variant.</x-andach-alert>
<x-andach-alert variant="secondary">This is the <strong>secondary</strong> variant.</x-andach-alert>
<x-andach-alert variant="success">This is the <strong>success</strong> variant.</x-andach-alert>
<x-andach-alert variant="warning">This is the <strong>warning</strong> variant.</x-andach-alert>
<x-andach-alert variant="danger">This is the <strong>danger</strong> variant.</x-andach-alert>
In addition to these unique variables, there are also generic arguments available for all components.
| Attribute Name | Type | Default Value | Description |
|---|---|---|---|
| dismissible | bool | false | Adds a close button to the alert, allowing users to dismiss it. |
| icon | string | '' | Adds an icon to the left side of the alert. Accepts full HTML string such as "<i class='fa-solid fa-mug-hot'></i>" which allows you to use any icon library (FontAwesome, Heroicons, etc.). |
| title | string | '' | Adds a bold title to the alert, displayed above the main content. |
Add visual context with icons and structured content with titles:
<x-andach-alert
variant="success"
title="Account Created Successfully"
icon="<i class='fa-solid fa-user-check'></i>">
Welcome to our platform! Your account has been created and verified.
</x-andach-alert>
<x-andach-alert
variant="warning"
icon="<i class='fa-solid fa-exclamation-triangle'></i>">
Your session will expire in 5 minutes. Please save your work.
</x-andach-alert>
Allow users to close alerts when they're no longer needed:
<x-andach-alert
variant="primary"
:dismissible="true"
title="Cookie Notice"
icon="<i class='fa-solid fa-cookie-bite'></i>">
We use cookies to enhance your browsing experience.
</x-andach-alert>
Choose from five different sizes to match your design needs:
<x-andach-alert size="xs" dismissible>Extra small alert</x-andach-alert>
<x-andach-alert size="sm" dismissible>Small alert</x-andach-alert>
<x-andach-alert size="base" dismissible>Base size alert (default)</x-andach-alert>
<x-andach-alert size="lg" dismissible>Large alert</x-andach-alert>
<x-andach-alert size="xl" dismissible>Extra large alert</x-andach-alert>
Control styling with boolean attributes:
<x-andach-alert variant="primary" :border="false">Alert without border</x-andach-alert>
<x-andach-alert variant="warning" :ring="true">Alert with ring effect</x-andach-alert>
<x-andach-alert variant="brand" :shadow="true">Alert with shadow</x-andach-alert>
<x-andach-alert variant="success" :rounded="false">Alert with square corners</x-andach-alert>