The personal finance app for everyone (by everyone)
Ruby
<%# locals: (message:, description:, close_label: nil) %>
<div id="cta">
<%= tag.div class: "relative flex flex-col gap-4 rounded-lg bg-container p-4 group w-full md:max-w-80 shadow-border-xs", data: { controller: "element-removal" } do %>
<%# Pass close_label for a plain "close this notification" control. It sits outside the %>
<%# content stack so the stack's gaps can't push it out of the corner. %>
<% if close_label %>
<%= icon "x",
as_button: true,
size: "sm",
class: "absolute top-2 right-2",
title: close_label,
aria: { label: close_label },
data: { action: "element-removal#remove" } %>
<% end %>
<%= tag.div class: class_names("flex gap-3", "pr-6": close_label.present?) do %>
<div class="h-5 w-5 shrink-0 p-px text-primary">
<div class="flex h-full items-center justify-center rounded-full bg-success text-inverse">
<%= icon "check", size: "xs", color: "current" %>
</div>
</div>
<div class="space-y-1 min-w-0">
<%= tag.p message, class: "text-primary text-sm font-medium" %>
<%= tag.p description, class: "text-secondary text-sm" %>
</div>
<% end %>
<%# Actions span the full toast width, not just the text column, so longer labels stay on one row. %>
<%= yield %>
<% end %>
</div>