11 · Navegação

Stepper

color (8) · size xs–lg · horizontal/vertical · estados done/current/error/todo · variant canvas

Indicador de etapas de um fluxo (wizard).

Avançando de etapa

1 Pedido
2 Separação
3 Nota fiscal
4 Entrega
.heex
<.stepper color="primary" loop><:step label="Pedido" style="--dl:0.0s" /><:step label="Separação" style="--dl:1.4s" /><:step label="Nota fiscal" style="--dl:2.8s" /><:step label="Entrega" style="--dl:4.2s" /></.stepper>

color

neutral
Conta
Plano
3 Pagamento
4 Revisão
primary
Conta
Plano
3 Pagamento
4 Revisão
secondary
Conta
Plano
3 Pagamento
4 Revisão
info
Conta
Plano
3 Pagamento
4 Revisão
success
Conta
Plano
3 Pagamento
4 Revisão
warning
Conta
Plano
3 Pagamento
4 Revisão
error
Conta
Plano
3 Pagamento
4 Revisão
.heex
<div class="flex flex-col gap-[10px]"><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">neutral</span><.stepper current={2} color="neutral" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">primary</span><.stepper current={2} color="primary" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">secondary</span><.stepper current={2} color="secondary" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">info</span><.stepper current={2} color="info" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">success</span><.stepper current={2} color="success" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">warning</span><.stepper current={2} color="warning" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div><div class="flex flex-wrap items-center gap-2.5"><span class="text-xs text-muted font-mono w-[80px]">error</span><.stepper current={2} color="error" class="flex-1"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div></div>

size · estados (done, current, error, todo)

1 Conta
2 Plano
3 Pagamento
4 Revisão
1 Conta
2 Plano
3 Pagamento
4 Revisão
Conta
Plano
3 Pagamento
4 Revisão
Conta
Plano
3 Pagamento
4 Revisão
Conta
Plano
! Pagamento
4 Revisão
.heex
<div class="flex flex-col gap-[14px]"><.stepper current={2} color="primary" size="xs"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper><.stepper current={2} color="primary" size="sm"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper><.stepper current={2} color="primary"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper><.stepper current={2} color="primary" size="lg"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper><.stepper current={2} error color="primary"><:step label="Conta" style="--dl:0.0s" /><:step label="Plano" style="--dl:1.4s" /><:step label="Pagamento" style="--dl:2.8s" /><:step label="Revisão" style="--dl:4.2s" /></.stepper></div>

orientation="vertical"

ContaDados do CNPJ
PlanoProfissional
3 PagamentoCartão final 4417
4 RevisãoConfirme e ative
Pedido recebido14:02
Separado14:40
3 NF-e emitidaagora
4 Saiu para entrega—
.heex
<div class="grid grid-cols-2 gap-[16px]"><.stepper orientation="vertical" current={2} color="primary"><:step label="Conta" sub="Dados do CNPJ" style="--dl:0.0s" /><:step label="Plano" sub="Profissional" style="--dl:1.4s" /><:step label="Pagamento" sub="Cartão final 4417" style="--dl:2.8s" /><:step label="Revisão" sub="Confirme e ative" style="--dl:4.2s" /></.stepper><.stepper orientation="vertical" current={2} color="success"><:step label="Pedido recebido" sub="14:02" style="--dl:0.0s" /><:step label="Separado" sub="14:40" style="--dl:1.4s" /><:step label="NF-e emitida" sub="agora" style="--dl:2.8s" /><:step label="Saiu para entrega" sub="—" style="--dl:4.2s" /></.stepper></div>

Valores da API que completam a paridade

accentcolor=accent
md size=md
1 Conta
2 Plano
3 Fim
variant=classic
.heex
<div class="grid grid-cols-3 gap-[14px]"><div class="flex flex-col items-start gap-1.5"><.badge color="primary" variant="solid">accent</.badge><span class="font-mono text-[11px] text-muted">color=accent</span></div><div class="flex flex-col items-start gap-1.5"><.chip label="md" /><span class="font-mono text-[11px] text-muted">size=md</span></div><div class="flex flex-col items-start gap-1.5"><.stepper color="primary" class="w-[260px]" current={1}><:step label="Conta" marker="1" state="done" /><:step label="Plano" marker="2" /><:step label="Fim" marker="3" /></.stepper><span class="font-mono text-[11px] text-muted">variant=classic</span></div></div>

Uso

<.stepper steps={~w(Conta Plano Pagamento Revisão)} current={2} />

Regras

  • Concluído: teal com check; atual: borda ink com halo; futuro: neutro.

Referência da API

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

Steps: numbered or plain points joined by a line (steps/1) and the progress stepper of a wizard (stepper/1). Both draw the canvas steps; stepper variant="classic" is the old bar of numbered squares. Styled only with Tailwind utilities; the colour enters as --c, --c-on and --c-ink (see LedgerUI.Color; accent is primary) and every part carries data-part (steps, step, step-marker, step-label, step-sub, step-line).

<.stepper current={2}>
  <:step label="Account" sub="Tax id and address" />
  <:step label="Plan" />
  <:step label="Payment" />
</.stepper>

<.steps color="primary" size="sm">
  <:step label="Cart" state="done">1</:step>
  <:step label="Shipping" state="current">2</:step>
</.steps>

current is the 0-based index of the step being worked on: the ones before are done, the ones after todo; with error the current one is flagged. A step's own state wins. The marker of a step is, in order: its marker text, its icon, a check when done (numbers for the xs/sm dots), ! when error, else its number.

Notes:

  • color and size on stepper/1 are additions to the README (the canvas previews vary them).
  • Accessibility is rendered server-side: the root is role="list", each step role="listitem"; the current (or flagged) one has aria-current="step" and, on stepper/1, every step has an aria-label with its label and its state name (state_names, e.g. "Company, Completed"). A :step takes style (animation delays) and any other attribute.
  • The kit CSS classes the README mentions (steps, step-primary) are replaced by utilities.

<.steps>

Attr Type Default Values / notes
color :string "neutral" neutral, primary, secondary, accent, info, success, warning, error
orientation :string "horizontal" horizontal, vertical
size :string "md" xs, sm, md, lg
line_space :boolean false
class :any nil

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

Slots:

  • <:step> (required) - attrs: label, color, ping, current, state, class, style

<.stepper>

Attr Type Default Values / notes
orientation :string "horizontal" horizontal, vertical
current :integer nil
error :boolean false
variant :string "canvas" canvas, classic
state_names :map %{"current" => "Current", "done" => "Completed", "error" => "Needs attention", "todo" => "Upcoming"}
color :string nil nil, neutral, primary, secondary, accent, info, success, warning, error
size :string nil nil, xs, sm, md, lg
loop :boolean false The animated mock: the steps fill in turn (stagger them with style="--dl:1.4s"); the states are not drawn.
class :any nil

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

Slots:

  • <:step> (required) - attrs: label, sub, state, marker, icon, class, style