10 · Feedback

ToastCard

Aura (spin/dual/glow), progress, deploy and ERP status, colors, thickness, dark, aura on any element, undo, error, stack

A notification in three modes: with an aura (a thin, rotating light border while the assistant or an external process works), progress (a background that fills up to 100%) and status (compact and dark, for long processes with an action).

Basic — aura while the assistant or an external process works

Assistente lendo a nota NF-e 48.211 · 44 itens
Conciliação pronta 18 lançamentos casados
Certificado vence hoje Renove para continuar emitindo
.heex
<div class="flex flex-col gap-4">
  <.toast_card aura="spin" aura_tone="ai" busy dismissible={false} kind="primary" icon="sparkles" title="Assistente lendo a nota" description="NF-e 48.211 · 44 itens" />
  <.toast_card aura="dual" aura_tone="ai" dismissible={false} kind="success" icon="check-circle" title="Conciliação pronta" description="18 lançamentos casados"><:action><.button color="neutral" variant="outline" size="sm" shape="rounded">Revisar</.button></:action></.toast_card>
  <.toast_card aura="glow" aura_tone="warn" dismissible={false} kind="warning" icon="alert" title="Certificado vence hoje" description="Renove para continuar emitindo"><:action><.button color="neutral" variant="solid" size="sm" shape="rounded">Renovar</.button></:action></.toast_card>
</div>

Example

Posição padrão: centro, embaixoTodo toast aparece centralizado embaixo (center-bottom), o mais novo por cima; a largura acompanha o texto, até 440px. Para um canto, passe position no toaster ou no send_toast.
NF-e 48.211 autorizada Protocolo 129 2611 0004 8211
Deploy f798c00 está compilando em nexus · main
.heex
<b class="text-[15px]">Posição padrão: centro, embaixo</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">Todo toast aparece centralizado embaixo (center-bottom), o mais novo por cima; a largura acompanha o texto, até 440px. Para um canto, passe position no toaster ou no send_toast.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="relative h-[300px] overflow-hidden rounded-[14px] border border-line bg-panel">
  <div class="flex flex-col gap-2.5 px-[18px] py-4"><.skeleton animation={nil} class="h-2.5 w-[40%]" /><.skeleton animation={nil} class="h-2.5 w-[65%]" /><.skeleton animation={nil} class="h-2.5 w-[52%]" /></div>
  <div class="absolute inset-x-0 bottom-[18px] flex flex-col items-center gap-2 px-4">
    <div class="w-[380px] max-w-full"><.toast_card kind="success" icon="check-circle" title="NF-e 48.211 autorizada" description="Protocolo 129 2611 0004 8211" dismissible={false} /></div>
    <.status_toast state="run">Deploy <b>f798c00</b> está compilando em <b>nexus · main</b><:action>Cancelar</:action></.status_toast>
  </div>
</div>
</div>

Example (2)

ProgressoO fundo se preenche até 100%; concluído fica verde e mostra o resultado; falha não some sozinha.
Emitindo NF-e do pedido #2491 Assinando o XML…
42%
NF-e 48.212 autorizada Protocolo 129 2611 0004 8221
100%
Envio da planilha falhou Linha 214: CNPJ inválido
.heex
<b class="text-[15px]">Progresso</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">O fundo se preenche até 100%; concluído fica verde e mostra o resultado; falha não some sozinha.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-3">
  <.toast_card progress={42} kind="primary" icon="file" title="Emitindo NF-e do pedido #2491" description="Assinando o XML…" dismissible={false} />
  <.toast_card progress={100} progress_state="done" kind="success" icon="check" title="NF-e 48.212 autorizada" description="Protocolo 129 2611 0004 8221" dismissible={false} />
  <.toast_card progress={0} progress_state="fail" kind="error" icon="x-circle" title="Envio da planilha falhou" description="Linha 214: CNPJ inválido" dismissible={false}><:action><.button color="neutral" variant="outline" size="sm" shape="rounded">Tentar de novo</.button></:action></.toast_card>
</div>
</div>

Example (3)

Status (inverso)Compacto e escuro nos dois temas, para processos longos: o círculo enche enquanto roda (ou mostra o % real), fila tracejada, ponto verde quando conclui e vermelho quando falha. Nomes em destaque, ação à direita.
Deploy f798c00 está compilando em nexus · main
Deploy a41e2d9 na fila, 2 à frente
Deploy f798c00 publicado em 38s
Deploy c03b7e1 falhou na etapa build
.heex
<b class="text-[15px]">Status (inverso)</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">Compacto e escuro nos dois temas, para processos longos: o círculo enche enquanto roda (ou mostra o % real), fila tracejada, ponto verde quando conclui e vermelho quando falha. Nomes em destaque, ação à direita.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col items-start gap-2.5">
  <.status_toast state="run">Deploy <b>f798c00</b> está compilando em <b>nexus · main</b><:action>Cancelar</:action></.status_toast>
  <.status_toast state="queue">Deploy <b>a41e2d9</b> na fila, <b>2 à frente</b><:action>Cancelar</:action></.status_toast>
  <.status_toast state="ok">Deploy <b>f798c00</b> publicado em <b>38s</b><:action ghost>Logs</:action><:action>Abrir</:action></.status_toast>
  <.status_toast state="err">Deploy <b>c03b7e1</b> falhou na etapa <b>build</b><:action>Ver logs</:action></.status_toast>
</div>
</div>

Example (4)

Status no ERPO mesmo formato para lote de notas, importação e backup.
Emitindo 32 NF-e do lote #118
Importando extrato BB, 412 de 980 linhas
Backup concluído, 1,2 GB
.heex
<b class="text-[15px]">Status no ERP</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">O mesmo formato para lote de notas, importação e backup.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col items-start gap-2.5">
  <.status_toast state="run">Emitindo <b>32 NF-e</b> do lote <b>#118</b><:action>Cancelar</:action></.status_toast>
  <.status_toast state="run" percent={42}>Importando <b>extrato BB</b>, <b>412 de 980</b> linhas<:action>Ocultar</:action></.status_toast>
  <.status_toast state="ok"><b>Backup</b> concluído, <b>1,2 GB</b><:action>Baixar</:action></.status_toast>
</div>
</div>

Example (5)

Variantes da auraspin gira enquanto trabalha; dual (duas cores) quando o resultado fica pronto; glow pulsa, sem girar, quando precisa do usuário.
Assistente conciliando o extrato Banco do Brasil · 64 lançamentos
Resumo do mês pronto Gerado de 1.284 pedidos
3 pedidos aguardam sua aprovação Mercadinho Bom Preço e mais 2
.heex
<b class="text-[15px]">Variantes da aura</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">spin gira enquanto trabalha; dual (duas cores) quando o resultado fica pronto; glow pulsa, sem girar, quando precisa do usuário.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-3">
  <.toast_card aura="spin" aura_tone="ai" busy dismissible={false} kind="primary" icon="sparkles" title="Assistente conciliando o extrato" description="Banco do Brasil · 64 lançamentos"></.toast_card>
  <.toast_card aura="dual" aura_tone="ai" dismissible={false} kind="success" icon="check-circle" title="Resumo do mês pronto" description="Gerado de 1.284 pedidos"><:action><.button color="neutral" variant="outline" size="sm" shape="rounded">Abrir</.button></:action></.toast_card>
  <.toast_card aura="glow" aura_tone="warn" dismissible={false} kind="warning" icon="alert" title="3 pedidos aguardam sua aprovação" description="Mercadinho Bom Preço e mais 2"><:action><.button color="neutral" variant="solid" size="sm" shape="rounded">Revisar</.button></:action></.toast_card>
</div>
</div>

Example (6)

Coresaura_color segue o significado: assistant (teal + violeta), primary, info, success, warning, error.
Sincronizando estoque Filial Serrinha
Pagamento recebido Pix · R$ 3.120,50
SEFAZ recusou a nota Rejeição 539 · duplicidade
.heex
<b class="text-[15px]">Cores</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">aura_color segue o significado: assistant (teal + violeta), primary, info, success, warning, error.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-3">
  <.toast_card aura="spin" aura_tone="info" busy dismissible={false} kind="info" icon="refresh" title="Sincronizando estoque" description="Filial Serrinha"></.toast_card>
  <.toast_card aura="spin" aura_tone="pos" dismissible={false} kind="success" icon="check" title="Pagamento recebido" description="Pix · R$ 3.120,50"></.toast_card>
  <.toast_card aura="glow" aura_tone="neg" dismissible={false} kind="error" icon="x-circle" title="SEFAZ recusou a nota" description="Rejeição 539 · duplicidade"></.toast_card>
</div>
</div>

Example (7)

Espessuraaura_size xs (0,75px), sm (1px), padrão (1,25px) e lg (2px): fina por padrão; a mais grossa só para chamar atenção.
Aura xs Assistente trabalhando
Aura sm Assistente trabalhando
Aura default Assistente trabalhando
Aura lg Assistente trabalhando
.heex
<b class="text-[15px]">Espessura</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">aura_size xs (0,75px), sm (1px), padrão (1,25px) e lg (2px): fina por padrão; a mais grossa só para chamar atenção.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-3">
  <.toast_card aura="spin" aura_tone="ai" aura_width="xs" busy dismissible={false} kind="primary" icon="sparkles" title="Aura xs" description="Assistente trabalhando"></.toast_card>
  <.toast_card aura="spin" aura_tone="ai" aura_width="sm" busy dismissible={false} kind="primary" icon="sparkles" title="Aura sm" description="Assistente trabalhando"></.toast_card>
  <.toast_card aura="spin" aura_tone="ai" busy dismissible={false} kind="primary" icon="sparkles" title="Aura default" description="Assistente trabalhando"></.toast_card>
  <.toast_card aura="spin" aura_tone="ai" aura_width="lg" busy dismissible={false} kind="primary" icon="sparkles" title="Aura lg" description="Assistente trabalhando"></.toast_card>
</div>
</div>

Example (8)

Toast escuroinvert para destacar sobre telas claras; a aura continua visível.
Transcrevendo a reunião Revisão comercial · 38 min de áudio
Transcrição pronta 12 tarefas encontradas
.heex
<b class="text-[15px]">Toast escuro</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">invert para destacar sobre telas claras; a aura continua visível.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-3">
  <.toast_card aura="spin" aura_tone="ai" busy tone="dark" dismissible={false} kind="primary" icon="mic" title="Transcrevendo a reunião" description="Revisão comercial · 38 min de áudio"></.toast_card>
  <.toast_card aura="dual" aura_tone="ai" tone="dark" dismissible={false} kind="success" icon="check-circle" title="Transcrição pronta" description="12 tarefas encontradas"><:action><.button color="neutral" variant="soft" size="sm" shape="rounded">Ver</.button></:action></.toast_card>
</div>
</div>

Example (9)

Aura em qualquer elemento<.aura> aplica o mesmo anel em botão, campo ou card.
Pedido #2492 Assistente preenchendo 44 itens…
.heex
<b class="text-[15px]">Aura em qualquer elemento</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">&lt;.aura&gt; aplica o mesmo anel em botão, campo ou card.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-wrap items-center gap-[18px]">
  <.aura tone="ai" width="sm" radius="pill"><.button color="neutral" variant="outline" size="md" shape="pill" class="gap-1.5 border-0 bg-panel"><.icon name="sparkles" />Gerar resumo</.button></.aura>
  <.aura tone="ai" radius="r12"><.input icon="sparkles" readonly value="Lendo o pedido por foto…" class="w-[300px] border-0" /></.aura>
  <.aura tone="ai" radius="r12"><div class="flex w-[300px] flex-col gap-1.5 bg-panel p-3.5"><b>Pedido #2492</b>
    <span class="text-xs text-muted">Assistente preenchendo 44 itens…</span>
    <.progress value={70} color="primary" size="sm" /></div></.aura>
</div>
</div>

Example (10)

Com desfazerAção reversível sem modal de confirmação.
Pedido #2488 excluído
.heex
<b class="text-[15px]">Com desfazer</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">Ação reversível sem modal de confirmação.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<.toast_card tone="dark" kind="neutral" icon="trash" title="Pedido #2488 excluído" close_label="Fechar"><:action><.button color="white" variant="soft" size="sm" shape="rounded">Desfazer</.button></:action></.toast_card>
</div>

Example (11)

ErroDiz o que fazer.
Não foi possível emitir SEFAZ fora do ar. Tentaremos em 5 min.
.heex
<b class="text-[15px]">Erro</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">Diz o que fazer.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<.toast_card kind="error" icon="x-circle" title="Não foi possível emitir" description="SEFAZ fora do ar. Tentaremos em 5 min." close_label="Fechar" />
</div>

Example (12)

PilhaNovos entram no topo; com o ponteiro em cima a pilha abre.
NF-e 48.211 autorizada agora
Novo pedido #2492 há 1 min
.heex
<b class="text-[15px]">Pilha</b><span class="mb-1.5 text-[13px] leading-[18px] text-muted">Novos entram no topo; com o ponteiro em cima a pilha abre.</span>
<div class="rounded-[16px] border border-line bg-tray p-[22px]">
<div class="flex flex-col gap-2">
  <.toast_card kind="success" icon="check" title="NF-e 48.211 autorizada" description="agora" close_label="Fechar" />
  <.toast_card kind="primary" icon="bell" title="Novo pedido #2492" description="há 1 min" close_label="Fechar" />
</div>
</div>

API values that complete the parity

Toast claro tone=light
tone=light
accent
aura_tone=accent
violet
aura_tone=violet
.heex
<div class="grid grid-cols-3 gap-3.5">
  <div class="flex flex-col items-start gap-1.5"><.toast_card kind="primary" icon="bell" title="Toast claro" description="tone=light" dismissible={false} /><span class="font-mono text-[11px] text-muted">tone=light</span></div>
  <div :for={t <- ~w(accent violet)} class="flex flex-col items-start gap-1.5"><.toast_card aura="spin" aura_tone={t} aura_shadow={false} title={t} dismissible={false} /><span class="font-mono text-[11px] text-muted">aura_tone={t}</span></div>
</div>

Try it: fires the real toast

kind
com ação
position
.heex
<div class="flex flex-col gap-3">
  <div class="flex flex-wrap items-center gap-2.5">
    <span class="w-20 font-mono text-xs text-muted">kind</span>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Alterações salvas", kind: "neutral")}>Neutral</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Nova versão disponível", kind: "info", description: "Atualize para a 2.4")}>Info</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("NF-e 48.211 autorizada", kind: "success", description: "Protocolo 129 2611")}>Success</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Estoque baixo: café", kind: "warning")}>Warning</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Falha ao emitir a nota", kind: "error", description: "SEFAZ-BA fora do ar")}>Error</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Emitindo NF-e…", kind: "loading", description: "Transmitindo à SEFAZ-BA")}>Loading</.button>
  </div>
  <div class="flex flex-wrap items-center gap-2.5">
    <span class="w-20 font-mono text-xs text-muted">com ação</span>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Pedido #2491 excluído", kind: "neutral", actions: [%{label: "Desfazer"}])}>Excluir → Desfazer</.button>
    <.button color="neutral" variant="outline" size="sm" phx-click={show_toast("Pagamento recebido", kind: "success", invert: true)}>invert</.button>
  </div>
  <div class="flex flex-wrap items-center gap-2.5">
    <span class="w-20 font-mono text-xs text-muted">position</span>
    <.button :for={pos <- ~w(left-top center-top right-top left-bottom center-bottom right-bottom)} color="neutral" variant="soft" size="sm" phx-click={show_toast("Posição: #{pos}", kind: "info", position: pos)}>{pos}</.button>
  </div>
  <.toaster id="ledger-toaster" />
</div>

Usage

<.toast_card icon="huge-sparkles" title="Assistente lendo a nota" description="NF-e 48.211 · 44 itens" busy aura aura_tone="ai" />
<.toast_card kind="success" title="NF-e autorizada" progress={100} progress_state="done" />
<.toast_card tone="dark" kind="neutral" title="Pedido #2488 excluído"><:action>Desfazer</:action></.toast_card>

Rules

  • Aura: spin while working, dual when the result is ready, glow when it needs the person.
  • Progress: the background fills up to 100%; done green with the result; fail red, stays, with a retry action.
  • Status: dark in both themes, names in bold, action on the right; ghost for a secondary action.
  • tone="dark"/invert stands out on light screens without losing the aura. A reversible action uses Undo, not a modal.

API reference

Todos os function components, atributos, valores e slots que este componente cobre.

Notifications: the toaster, toasts pushed by the server, and the cards drawn in the page.

Mount the toaster once, in the layout every LiveView renders (it reads the flash):

<.toaster flash={@flash} />

Then, from the server:

conn |> put_toast("Saved", color: "success") |> redirect(to: ~p"/orders")
socket |> put_toast("Saved", color: "success") |> push_navigate(to: ~p"/orders")
socket |> send_toast("Copied", color: "info", position: "center-top")
socket |> send_toast("Sending…", id: "nfe-42", kind: :loading)
socket |> update_toast("nfe-42", replace: true, kind: :success, title: "Sent")
socket |> dismiss_toast("nfe-42")
socket |> clear_toasts()

put_toast/3 goes through the flash (it survives a redirect and the standard :info/:error flash messages are drawn too); send_toast/3 pushes to the page at once. From the browser, with no round trip (both go through a ledger:toast event the toaster hook listens to):

<button phx-click={show_toast("Copied", color: "info")}>Copy</button>
<button phx-click={dismiss_toast("nfe-42")}>Hide</button>

Options: id (the same id updates a toast in place), title (**object** is drawn in bold in the status pill), description, kind (the format, :status or :card, or the colour kind neutral info success warning error loading), status (run queue ok err, the compact dark pill; :queue is the dashed ring of a task waiting), color, position, duration (ms; 0 or :infinity keeps it until closed), close, timer, template (id of a <template> whose first element is shown), actions ([label:, event:, value:, target:, href:, navigate:, patch:, js:, dismiss:, variant:, color:]), aura (true :dual :glow, with aura_size/aura_color), progress (0..100, also value; bar: true draws a line instead of the fill), steps/step and invert.

Two formats

  • status: the dark pill (bottom centre by default). The icon fills with progress, or is the dashed ring with status: :queue; it carries at most one action and the progress in %. It goes away in 5 s, 8 s with an action, and stays while it works (kind: :loading, status: :run, progress under 100).
  • card: description, any number of actions, progress and steps. It stays while it has actions; with persist_errors an error or a warning card stays until closed.

The pill's action is a filled button; variant: :ghost draws it as text only (no background), the way "Hide" and "Undo" read in the design. action: is one action, actions: a list (the pill shows the first):

socket |> send_toast("Cancelling **PUB-1005279**", status: :queue, action: %{label: "Undo", event: "undo", variant: :ghost})
socket |> send_toast("Batch **#118** issued", action: [label: "View", href: "/notes"])
socket |> send_toast("Order **ORD-7** sent", action: [label: "View order", navigate: ~p"/orders/7"])

href is a plain link (the page reloads). navigate: and patch: are LiveView links (data-phx-link): the screen changes with no reload, and the toast closes on the click. They take a path of this site only (/orders/7, /orders?tab=open): a URL with a host, //host, javascript: or a backslash is dropped from the action. This holds for send_toast, put_toast, update_toast, show_toast and the flash. In status_toast/1 an :action slot takes the same href/navigate/patch; in toast_card/1 write a <.link navigate={...}> inside the :action slot.

In a card with progress, icon keeps the document-type icon (PDF, NF-e...) and the tile's background fills from 0 to 100% with the progress (instead of the spinning ring); update_toast moves the level.

kind: :status | :card forces the format. Otherwise a description, an aura, steps, progress or more than one action make a card, and everything else a pill. Each format has its own place: <.toaster position="center-bottom" card_position="right-top" /> (status_position is the pill's when it must differ from position), and a toast's own position: wins.

Queue and updates

Each stack shows max_visible toasts (three, the blades of the pile); the rest wait in a queue and come in as the others leave, their time counting from then. A toast sent with an id already on screen (or in the queue) updates that toast. update_toast/3 changes only the options it is given; with replace: true it swaps the whole toast (the way a loading toast turns into its result, even in the other format) and starts its time again:

socket |> send_toast("Importing **orders.csv**", id: "imp", status: :run, progress: 10)
socket |> update_toast("imp", progress: 64)
socket |> update_toast("imp", replace: true, kind: :status, color: :success, title: "Imported **orders.csv**")

The client side is the LedgerUI.Toaster hook (priv/static/ledger_ui/hooks/toaster.js).

toast_card/1 and status_toast/1 draw the same cards where they are written. For docs and design reviews, toast_card progress_loop fills and counts by itself, and toast_loop/1 plays the toaster's loops (toasts piling up, or a loading toast giving way to its answer) with CSS only.

<.toaster>

Attr Type Default Values / notes
id :string "ledger-toaster"
flash :map %{} The @flash, where put_toast/3 leaves its toasts.
position :string "center-bottom" left-top, left-bottom, center-top, center-bottom, right-top, right-bottom
duration :integer 5000
status_position :string nil nil, left-top, left-bottom, center-top, center-bottom, right-top, right-bottom - Where the status pill goes; position when nil.
card_position :string nil nil, left-top, left-bottom, center-top, center-bottom, right-top, right-bottom - Where the card goes ("right-top" is the usual); position when nil.
max_visible :integer 3 Toasts in view at once, per stack; the rest wait in a queue and enter as the others leave. With stack (the blades) three is the most that fits.
stack :boolean true
persist_errors :boolean false
timer :boolean true
invert :boolean false
close_label :string "Close"
loading_label :string "Loading"
contained :boolean false Draw the toaster inside its parent (a demo panel) instead of over the page.
class :any nil

Any other HTML/phx attribute goes to the root element.

Slots:

  • <:inner_block> - Toasts already on screen at render time (a static preview), in the stack.

<.toast_card>

Attr Type Default Values / notes
id :string nil
tone :string "light" light, dark
kind :string "neutral" neutral, primary, success, warning, error, info
icon :string nil
title (required) :string
description :string nil
dismissible :boolean true
close_label :string "Close"
on_dismiss :any nil
busy :boolean false
busy_label :string nil Accessible name of the spinner (none when nil).
progress :integer nil
progress_state :string "run" run, done, fail
progress_loop :boolean false Demo: the fill and the % go from 4 to 100 by themselves, in a 5s loop (lu-fill/lu-pct); it wins over progress.
steps :integer nil Number of steps: draws one segment per step under the text (the hook's steps).
step :integer 0 Steps done; the next segment is the current one (violet, pulsing). steps is required.
steps_loop :boolean false Demo: the segments advance by themselves, in a 6s loop (up to 5 steps).
aura :string nil nil, `,spin,dual,glow`
aura_tone :string "accent" accent, ai, info, pos, warn, neg, violet
aura_width :string "default" xs, sm, default, lg
aura_shadow :boolean true
aura_style :string nil Inline style of the aura wrapper (e.g. a fixed width); it is full width by default.
class :any nil

Any other HTML/phx attribute goes to the root element.

Slots:

  • <:action> - Buttons between the text and the close button.
  • <:icon_tile> - Replaces the icon inside the tile.

<.status_toast>

Attr Type Default Values / notes
state :string "run" run, queue, ok, err
status :string nil nil, run, queue, ok, err - The same as state; it wins when given.
percent :integer nil
class :any nil

Any other HTML/phx attribute goes to the root element, including action, action_variant.

Slots:

  • <:action> - attrs: ghost, variant, on_click, id, href, navigate, patch
  • <:inner_block>

<.toast_loop>

The loop of the toaster, for docs and design reviews (CSS only, no hook, no behaviour): the toasts of the :toast slots enter and pile up (mode="stack") or swap in place (mode="swap").

<.toast_loop mode="swap" class="w-[380px]">
  <:toast><.toast_card kind="primary" icon="sparkles" title="Issuing NF-e…" busy /></:toast>
  <:toast><.toast_card kind="success" icon="check-circle" title="NF-e authorised" /></:toast>
</.toast_loop>
Attr Type Default Values / notes
mode :string "stack" stack, swap - stack: up to three toasts come in one after the other and pile up (9s loop); swap: the first one (a loading toast) gives way to the second (its answer), in the same place (5s loop).
class :any nil

Any other HTML/phx attribute goes to the root element.

Slots:

  • <:toast> (required) - A toast (toast_card/1, status_toast/1...): three at most for stack, two for swap.