HeroCard
eyebrow · title · description · <:actions> · arte à direita esmaecendo · size md/lg · variant soft/panel · <:icon> · <:inner_block>
O cartão de boas-vindas ou de destaque no topo da página: o texto à esquerda (sobretítulo, título, descrição e ações) e uma paisagem à direita que esmaece no fundo do cartão.
A saudação entra, a paisagem respira e a meta enche
Novembro está 12% acima de outubro
Faltam 10 dias para fechar o mês. Três pedidos esperam aprovação.
<.hero_card id="hero-loop" animated eyebrow="Bom dia, Alex" title="Novembro está 12% acima de outubro" description="Faltam 10 dias para fechar o mês. Três pedidos esperam aprovação." meta="Meta de novembro" meta_value="R$ 184 mil de R$ 250 mil" meter={74} > <:actions> <.button color="mono" size="lg"><.icon name="plus" />Novo pedido</.button> <.button variant="outline" size="lg"><.icon name="arrow-up-right" />Ver relatório</.button> </:actions> </.hero_card>
size
Pedidos de hoje
48 pedidos, 6 aguardando separação.
Metas do trimestre
Alinhe a equipe e acompanhe o que importa em um só lugar.
<div class="flex flex-col gap-2"> <span class="font-mono text-xs text-muted">size="md"</span> <.hero_card id="hero-md" eyebrow="Painel" title="Pedidos de hoje" description="48 pedidos, 6 aguardando separação." > <:actions> <.button color="mono">Abrir pedidos</.button> </:actions> </.hero_card> <span class="font-mono text-xs text-muted">size="lg"</span> <.hero_card id="hero-lg" size="lg" eyebrow="Bem-vindo de volta" title="Metas do trimestre" description="Alinhe a equipe e acompanhe o que importa em um só lugar." > <:actions> <.button color="mono" size="lg"><.icon name="plus" />Novo pedido</.button> <.button variant="outline" size="lg"><.icon name="arrow-up-right" />Ver relatório</.button> </:actions> </.hero_card> </div>
variant
R$ 42 mil a receber esta semana
Doze faturas vencem até sexta.
R$ 42 mil a receber esta semana
Doze faturas vencem até sexta.
<div class="flex flex-col gap-2"> <span class="font-mono text-xs text-muted">variant="soft"</span> <.hero_card id="hero-soft" eyebrow="Financeiro" title="R$ 42 mil a receber esta semana" description="Doze faturas vencem até sexta." > <:actions> <.button variant="outline">Ver faturas</.button> </:actions> </.hero_card> <span class="font-mono text-xs text-muted">variant="panel"</span> <.hero_card id="hero-panel" variant="panel" eyebrow="Financeiro" title="R$ 42 mil a receber esta semana" description="Doze faturas vencem até sexta." > <:actions> <.button variant="outline">Ver faturas</.button> </:actions> </.hero_card> </div>
<:icon> · <:inner_block> · sem arte
Revise 3 pedidos com risco de atraso
O fornecedor de café avisou atraso de 2 dias.
Falta pouco para emitir sua primeira NF-e
<div class="flex flex-col gap-3.5"> <.hero_card id="hero-ai" variant="ai" eyebrow="Sugestão da IA" title="Revise 3 pedidos com risco de atraso" description="O fornecedor de café avisou atraso de 2 dias." > <:icon><.icon name="ai" size="sm" /></:icon> <:actions> <.button color="primary"><.icon name="ai" />Revisar agora</.button> <.button variant="ghost">Depois</.button> </:actions> </.hero_card> <.hero_card id="hero-nfe" eyebrow="Configuração" title="Falta pouco para emitir sua primeira NF-e" picture="none" steps={[ %{label: "Empresa", state: "done"}, %{label: "Certificado", state: "done"}, %{label: "Série e numeração", state: "current"}, %{label: "Teste"} ]} > <:actions> <.button color="mono">Continuar</.button> </:actions> </.hero_card> </div>
Uso
<.hero_card eyebrow="Bom dia, Alex" title="Novembro está 12% acima de outubro" description="Faltam 10 dias para fechar o mês."> <:actions> <.button color="mono" size="lg" icon="huge-add-01">Novo pedido</.button> <.button variant="outline" size="lg">Ver relatório</.button> </:actions> <:art><.summit /></:art> </.hero_card> <.hero_card eyebrow="Sugestão da IA" title="Revise 3 pedidos" variant="panel"> <:icon><.icon name="huge-ai-magic" /></:icon> <.progress_bar value={74} /> </.hero_card>
Regras
- Um por página, no topo.
- A arte (src ou <:art>) ocupa a direita e esmaece para o fundo do cartão; sem ela, o texto usa a largura toda.
- size="lg" para a página inicial; md nas demais. variant="panel" quando o fundo da página já é cinza.
- Movimento: o texto entra de baixo, as camadas da paisagem se movem devagar e a meta enche; repete em loop nos dois temas.
Referência da API
Todos os function components, atributos, valores e slots que este componente cobre.
The hero card: the welcome or the insight at the top of a page. The text on the left (an eyebrow in mono caps with an optional icon, the title, the description, a goal meter or a list of steps, and the actions) and a landscape on the right that fades into the card.
<.hero_card eyebrow="Bem-vindo de volta" title="Metas do trimestre" description="Alinhe a equipe.">
<:actions>
<.button color="mono" size="lg"><.icon name="plus" />Novo pedido</.button>
</:actions>
</.hero_card>
<.hero_card
eyebrow="Bom dia, Alex"
title="Novembro está 12% acima de outubro"
meta="Meta de novembro"
meta_value="R$ 184 mil de R$ 250 mil"
meter={74}
animated
/>
<.hero_card
eyebrow="Configuração"
title="Falta pouco para emitir sua primeira NF-e"
picture="none"
steps={[
%{label: "Empresa", state: "done"},
%{label: "Série e numeração", state: "current"},
%{label: "Teste"}
]}
/>
The picture on the right is the summit landscape (picture="summit", drawn with the --lu-hero-*
tokens, so it follows the theme), an <img> (src), the :art slot (your own SVG) or nothing
(picture="none"). size="lg" makes the card taller; variant="panel" puts it on the panel color
instead of the soft gray and variant="ai" is the soft card with the violet eyebrow (suggestions
from the assistant). animated adds the canvas loop: the text rises, the landscape breathes and
the meter fills (lu-hero-* keyframes). Styled only with Tailwind utilities.
hero_summit/1 is the landscape on its own, for other surfaces. Give each one on the page its
own id (the gradient ids derive from it).
<.hero_card>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
eyebrow |
:string |
nil |
The small mono caps line above the title. |
title (required) |
:string |
||
description |
:string |
nil |
|
src |
:string |
nil |
The picture on the right (replaces the landscape). |
alt |
:string |
"" |
|
position |
:string |
"center" |
The crop of the picture (object-position). |
picture |
:string |
"summit" |
summit, none - The picture when there is no src nor :art slot. |
size |
:string |
"md" |
md, lg |
variant |
:string |
"soft" |
soft, panel, ai |
heading |
:string |
"h2" |
h1, h2, h3 |
meta |
:string |
nil |
The label of the goal line (needs meta_value). |
meta_value |
:string |
nil |
The figures of the goal line, already formatted. |
meter |
:integer |
nil |
Goal progress, 0 to 100: draws the bar under meta. |
steps |
:list |
[] |
Chips of a checklist: %{label: "Empresa", state: "done" \| "current" \| "todo"}. |
animated |
:boolean |
false |
The canvas loop (mo-hero). |
id |
:string |
nil |
Names the card (aria-labelledby) and prefixes the art. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:actions><:art>- The picture as markup (an SVG), instead ofsrc.<:icon>- An icon before the eyebrow.<:inner_block>- Under the description: a note, a form, anything of your own.
<.hero_summit>
The landscape of hero_card/1: a thin delegate to LedgerUI.Components.Illustration.summit/1
(svg.lu-summit painted with the --hero-* tokens). Decorative: aria-hidden.
| Attr | Type | Default | Values / notes |
|---|---|---|---|
id |
:string |
"hs" |
Prefix of the gradient ids (hs-sky...): one per summit on a page. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.