toast(message, variant: :default, dismiss_after: 6000) do |t|
t.with_action { … }
end
toasts(flash: nil) # without a block, shows the flash
toasts without a block shows the flash (notice as a toast, alert as an error toast); put it once in the layout. Toasts leave after dismiss_after milliseconds (0 keeps them).
12 notas sincronizadas.
Não foi possível conectar. Tente de novo em alguns minutos.
<div class="doc-frame" style="height: 160px">
<%= toasts do %>
<%= toast "12 notas sincronizadas.", dismiss_after: 0 do |t| %>
<% t.with_action { button "Ver", size: :sm, variant: :ghost } %>
<% end %>
<%= toast "Não foi possível conectar. Tente de novo em alguns minutos.", variant: :error, dismiss_after: 0 %>
<% end %>
</div>