Flash
Flash notifications for displaying temporary feedback messages after actions.
Info Flash
Use
kind=info
for success messages, confirmations, and general information.
Info
Your changes have been saved successfully.
Error Flash
Use
kind=error
for error messages and validation failures.
Error
There was a problem processing your request.
With Title
Add a title for additional context using the
title
prop.
With Title
Success
Your profile has been updated.
Connection Error
Unable to reach the server. Please check your connection.
With Formatting
The inner block supports HTML for rich content.
With Formatting
File Uploaded
Your file report.pdf has been uploaded successfully.
Usage with LiveView
In LiveView, use
put_flash/3
to set flash messages that will be displayed automatically.
def handle_event("save", params, socket) do
case save_data(params) do
{:ok, _} ->
{:noreply, put_flash(socket, :info, "Changes saved!")}
{:error, _} ->
{:noreply, put_flash(socket, :error, "Failed to save")}
end
end