Alert
Attention-grabbing messages for user notifications.
The requested file is ready to download.
<.alert title="The requested file is ready to download." />
Variants
Use standard, info, success, warning, and error styles to communicate message nature.
Important update: Please read carefully
System maintenance scheduled for tonight
Critical error. Unable to process request
Low disk space. Action required soon
Payment successfully processed. Thank you!
New feature available. Check it out!
<.alert title="Important update: Please read carefully" />
<.alert variant="neutral" title="System maintenance scheduled for tonight" />
<.alert variant="error" title="Critical error. Unable to process request" />
<.alert variant="warning" title="Low disk space. Action required soon" />
<.alert variant="success" title="Payment successfully processed. Thank you!" />
<.alert variant="info" title="New feature available. Check it out!" />
Subtitle
Add a brief subtitle to provide additional clarity about the alert's main message.
Yeeey!
Photo uploaded!
Yeeey!
Your profile picture has been updated.
<.alert title="Yeeey!" subtitle="Your profile picture has been updated." />
Content
Include complex information or interactive elements within the alert body.
Update Available!
A new version of the application is available. Would you like to update now?
<.alert title="Update Available!">
<p>A new version of the application is available. Would you like to update now?</p>
<div class="mt-4 flex space-x-2">
<.button size="xs">Update Now</.button>
<.button size="xs" variant="ghost">Remind Me Later</.button>
</div>
</.alert>
Icon
Customize the alert's appearance by replacing or hiding icons to convey purpose.
Bitcoin price alert: Significant market movement
Bitcoin price alert: Significant market movement
<.alert title="Bitcoin price alert: Significant market movement">
<:icon>
<.icon name="hero-currency-dollar" class="size-5 text-amber-500" />
</:icon>
</.alert>
<.alert hide_icon title="Bitcoin price alert: Significant market movement" />
Actions
Add actionable elements like buttons or links for users to respond to alerts.
The requested file is ready to download.
<.alert
title="The requested file is ready to download."
on_close={JS.show(to: "#alert-closed-message")}
/>