10 · Feedback

EmptyStateCard

variant canvas/card/inline/table/plain · tone default/gradient/positive · color · level

Estado vazio de uma lista ou card, explicando o que vai aparecer e como começar.

Anéis pulsando em volta do ícone

Nenhum pedido ainda Os pedidos do balcão e do site aparecem aqui.
.heex
<.empty_state variant="card" icon="inbox" title="Nenhum pedido ainda">Os pedidos do balcão e do site aparecem aqui.<:action><.button icon="plus" color="mono" variant="solid" size="sm" shape="rounded">Novo pedido</.button></:action></.empty_state>

variant canvas · card · inline · table · plain × tone default/gradient/positive

default
Nenhum pedido ainda Os pedidos do balcão e do site aparecem aqui.
gradient
Nenhum pedido ainda Os pedidos do balcão e do site aparecem aqui.
positive
Nenhum pedido ainda Os pedidos do balcão e do site aparecem aqui.
.heex
<div class="grid grid-cols-3 gap-4">
  <div :for={t <- ~w(default gradient positive)} class="flex flex-col gap-1.5">
    <span class="font-mono text-xs text-muted">{t}</span>
    <div class="rounded-lg border border-line bg-panel">
      <.empty_state variant="card" icon="inbox" title="Nenhum pedido ainda" tone={t}>Os pedidos do balcão e do site aparecem aqui.<:action><.button icon="plus" color="mono" variant="solid" size="sm" shape="rounded">Novo pedido</.button></:action></.empty_state>
    </div>
  </div>
</div>

Valores da API que completam a paridade

color=neutral
color=success
color=error
Título nível 4
level=4
.heex
<div class="grid grid-cols-4 gap-3.5">
  <div :for={c <- ~w(neutral success error)} class="flex flex-col items-start gap-1.5"><.avatar icon="inbox" color={c} variant="soft" shape="rounded" size="44" /><span class="font-mono text-[11px] text-muted">color={c}</span></div>
  <div class="flex flex-col items-start gap-1.5"><.empty_state variant="card" level={4} title="Título nível 4" class="!p-0 [&_b]:text-[16px]" /><span class="font-mono text-[11px] text-muted">level=4</span></div>
</div>

Uso

<.empty_state icon="table-01" title="Nenhuma coorte ainda">…</.empty_state>

Regras

  • Diga o que vai aparecer aqui e dê uma ação direta.
  • Sem ilustrações de pessoas; só o ícone com anéis.

Referência da API

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

Empty state: what the area is, why it is empty and the one next step. Styled only with Tailwind utilities.

<.empty_state icon="inbox" title="No orders yet">
  Orders from the counter and the site show up here.
  <:action><.button size="sm">New order</.button></:action>
</.empty_state>

<.empty_state variant="inline" icon="inbox" title="No comments yet.">
  <a href="#">Write the first</a>
</.empty_state>

Variants:

  • canvas (default) - icon tile with two dashed frames, title, reason, actions;
  • card - centered block for a whole area, icon with pulsing rings (tone default, gradient or positive) and an optional kicker;
  • inline - compact dashed notice for lists and results (color neutral/success/error);
  • table - centered notice for the body of an empty table (a disc tinted by color);
  • plain - the faint one-line notice inside a card.

color also tints the plain line (a green "all caught up"). loop plays the canvas loop (mo-stg, CSS only): the notice fades in, stays and leaves, forever. inline_empty/1 (the one-line notice of a panel or a table cell) takes loop too.

level (2, 3 or 4) marks the title of a card as a heading (aria-level); without it the title is a plain bold line.

<.empty_state>

Attr Type Default Values / notes
variant :string "canvas" canvas, card, inline, table, plain
title (required) :string
kicker :string nil
icon :string nil
tone :string "default" default, gradient, positive
color :string "neutral" neutral, success, error
level :integer nil nil, 2, 3, 4
loop :boolean false The canvas loop (mo-stg): it fades in, stays, leaves, forever.
class :any nil

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

Slots:

  • <:action> - The next step.
  • <:illustration> - Replaces the icon.
  • <:inner_block> - The reason it is empty.

<.empty_state_card>

Same as empty_state/1 (same attributes and slots), under the name the design vitrine uses.

Attr Type Default Values / notes
variant :string "canvas" canvas, card, inline, table, plain
title (required) :string
kicker :string nil
icon :string nil
tone :string "default" default, gradient, positive
color :string "neutral" neutral, success, error
level :integer nil nil, 2, 3, 4
loop :boolean false The canvas loop (mo-stg): it fades in, stays, leaves, forever.
class :any nil

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

Slots:

  • <:action> - The next step.
  • <:illustration> - Replaces the icon.
  • <:inner_block> - The reason it is empty.

<.inline_empty>

The one-line empty state inside a panel or a table cell: an icon and a sentence, in a dashed box with no background (13/18px text, 8px gap).

<.inline_empty icon="inbox" text="No comments yet" />
Attr Type Default Values / notes
text (required) :string
icon :string nil
color :string "neutral" neutral, success, error
loop :boolean false The canvas loop (mo-stg): it fades in, stays, leaves, forever.
class :any nil

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

Slots:

  • <:action> - The next step.