Usage
# <% In your layout or view %>
<%= ui.flash %>
# <% In your controller %>
flash[:notice] = "Changes saved successfully."
flash[:alert] = "Something went wrong."Props
| Prop | Type | Default | Description |
|---|---|---|---|
dismissible | Boolean | true | Whether flash messages can be dismissed by clicking the close button. When true, messages auto-dismiss after 5 seconds. |
Also accepts any HTML attributes via **options (e.g., id:, data:, aria:). class: is also supported for custom styling.
Examples
Notice flash
<% flash[:notice] = "This is a notice flash message." %>
<%= ui.flash %>Alert flash
<% flash[:alert] = "This is an alert flash message." %>
<%= ui.flash %>Non-dismissible
<% flash[:notice] = "This message cannot be dismissed." %>
<%= ui.flash(dismissible: false) %>