06 · Exibição

Card

variant (11) · color (6) · gradient (5) · size xs–lg · body · divider · shape

O card do sistema: uma bandeja cinza com título em caixa-alta que abraça um painel branco.

Levantando ao passar o ponteiro

defaultFaturamento do mês
glowFaturamento do mês
gradientFaturamento do mês
.heex
<div class="grid grid-cols-3 gap-3"><.card variant="default" class="animate-[mo-lift_4s_ease-in-out_infinite]"><:title>default</:title><span>Faturamento do mês</span></.card><.card variant="glow" class="animate-[mo-lift_4s_ease-in-out_infinite]"><:title>glow</:title><span>Faturamento do mês</span></.card><.card variant="gradient" gradient="sky-blue" class="animate-[mo-lift_4s_ease-in-out_infinite]"><:title>gradient</:title><span>Faturamento do mês</span></.card></div>

variant (11)

defaultFaturamento do mês
flatFaturamento do mês
borderedFaturamento do mês
outlineFaturamento do mês
mutedFaturamento do mês
softFaturamento do mês
filledFaturamento do mês
solidFaturamento do mês
glowFaturamento do mês
gradientFaturamento do mês
gradient_outlineFaturamento do mês
.heex
<div class="grid grid-cols-4 gap-3"><.card :for={v <- ~w(default flat bordered outline muted soft filled solid glow gradient gradient_outline)} variant={v}><:title>{v}</:title><span>Faturamento do mês</span></.card></div>

color (soft/filled/solid/glow) · gradient (5)

solidFaturamento do mês
solidFaturamento do mês
solidFaturamento do mês
solidFaturamento do mês
solidFaturamento do mês
solidFaturamento do mês
purple-indigoFaturamento do mês
fuchsia-pinkFaturamento do mês
amber-orangeFaturamento do mês
sky-blueFaturamento do mês
green-fuchsiaFaturamento do mês
.heex
<div class="flex flex-col gap-2.5"><div class="grid grid-cols-6 gap-2"><.card :for={c <- ~w(primary secondary info success warning error)} variant="solid" color={c}><:title>solid</:title><span>Faturamento do mês</span></.card></div><div class="grid grid-cols-5 gap-2"><.card :for={g <- ~w(purple-indigo fuchsia-pink amber-orange sky-blue green-fuchsia)} variant="gradient" gradient={g}><:title>{g}</:title><span>Faturamento do mês</span></.card></div></div>

size xs–lg · body seamless/divided/separated/inset/flush

xs
sm
md
lg
seamless divided separated inset flush
.heex
<div class="flex flex-wrap items-center gap-2.5"><.card variant="default" color={nil} gradient={nil} size="xs"><:title>xs</:title></.card><.card variant="default" color={nil} gradient={nil} size="sm"><:title>sm</:title></.card><.card variant="default" color={nil} gradient={nil} style="padding:14px;min-height:0"><:title>md</:title></.card><.card variant="default" color={nil} gradient={nil} size="lg"><:title>lg</:title></.card><.chip :for={b <- ~w(seamless divided separated inset flush)}>{b}</.chip></div>

Valores da API que completam a paridade

Títuloalign=start
align=start
Títuloalign=center
align=center
Títuloalign=end
align=end
Títuloalign=between
align=between
rounded
shape=rounded
xl
shape=xl
base
size=base
xl
size=xl
CabeçalhoCorpo
divider=full
Título h1
level=1
.heex
<div class="flex flex-col gap-4"><div class="grid grid-cols-4 gap-3.5"><div :for={{a, css} <- [{"start", "flex-start"}, {"center", "center"}, {"end", "flex-end"}, {"between", "stretch"}]} class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} style={"width:100%;align-items:#{css}"}><:title>Título</:title><span>align={a}</span></.card><span class="font-mono text-[11px] text-muted">align={a}</span></div></div><div class="grid grid-cols-6 gap-3.5"><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} style="border-radius:10px;width:100%"><:title>rounded</:title></.card><span class="font-mono text-[11px] text-muted">shape=rounded</span></div><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} shape="xl" style="width:100%"><:title>xl</:title></.card><span class="font-mono text-[11px] text-muted">shape=xl</span></div><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} style="padding:14px;width:100%"><:title>base</:title></.card><span class="font-mono text-[11px] text-muted">size=base</span></div><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} style="padding:28px;width:100%"><:title>xl</:title></.card><span class="font-mono text-[11px] text-muted">size=xl</span></div><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} padded={false} style="width:100%"><b style="padding:12px">Cabeçalho</b><span style="border-top:1px solid var(--lu-line);padding:12px">Corpo</span></.card><span class="font-mono text-[11px] text-muted">divider=full</span></div><div class="flex flex-col items-start gap-1.5"><.card variant="default" color={nil} gradient={nil} style="width:100%"><b style="font-size:20px">Título h1</b></.card><span class="font-mono text-[11px] text-muted">level=1</span></div></div></div>

Perfil inset, imagem com bleed e Storage

Profile

Manage your public details.

All changes saved
Forest pathwoodscape.png

Storage

32 GB of 100 GB

.heex
<div class="grid grid-cols-3 items-start gap-5">
  <.card body="inset" variant="default">
    <:title>Profile</:title>
    <:description>Manage your public details.</:description>
    <:actions><.button size="sm" variant="outline">Edit</.button></:actions>
    <div class="flex flex-col gap-3">
      <.input name="hero-name" label="Name" value="Ada Lovelace" />
      <.input name="hero-email" label="E-mail" value="ada@example.com" />
    </div>
    <:footer><span>All changes saved</span><.button size="sm">Save</.button></:footer>
  </.card>
  <.card body="inset" variant="muted">
    <:bleed><svg viewBox="0 0 400 200" preserveAspectRatio="xMidYMid slice" class="block h-44 w-full" role="img" aria-label="Forest path"><defs><linearGradient id="hero-a" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#c9e4d6"/><stop offset="1" stop-color="#6fae8f"/></linearGradient></defs><rect width="400" height="200" fill="url(#hero-a)"/><path d="M0 130 Q80 90 160 120 T400 100 V200 H0Z" fill="#3f8465"/><path d="M0 160 Q120 120 220 150 T400 140 V200 H0Z" fill="#2c6650"/><path d="M170 200 Q190 150 200 120 Q215 150 240 200Z" fill="#e8dcc0" opacity=".85"/><g fill="#1f4d3c"><path d="M40 150 l14 -46 l14 46Z"/><path d="M70 156 l12 -38 l12 38Z"/><path d="M320 148 l16 -52 l16 52Z"/><path d="M350 156 l12 -36 l12 38Z"/></g></svg></:bleed>
    <:footer>
      <div class="flex flex-col leading-tight"><b class="text-sm text-ink">Forest path</b><span class="text-xs">woodscape.png</span></div>
      <.button size="sm" variant="outline" icon="download" aria-label="Download" />
    </:footer>
  </.card>
  <.card body="seamless">
    <:title>Storage</:title>
    <:actions><.button size="sm" variant="ghost" icon="more-h" aria-label="More" /></:actions>
    <p class="m-0 font-display text-3xl font-semibold tracking-tight text-ink">32 GB <span class="text-sm font-normal text-muted">of 100 GB</span></p>
    <.progress value={32} class="mt-3" />
  </.card>
</div>

Superfícies (default, muted, soft, outline, filled) em claro e escuro

default

Quiet surface

Content on the default surface.

muted

Quiet surface

Content on the muted surface.

soft

Quiet surface

Content on the soft surface.

outline

Quiet surface

Content on the outline surface.

filled

Quiet surface

Content on the filled surface.

default

Quiet surface

Content on the default surface.

muted

Quiet surface

Content on the muted surface.

soft

Quiet surface

Content on the soft surface.

outline

Quiet surface

Content on the outline surface.

filled

Quiet surface

Content on the filled surface.
.heex
<div class="flex flex-col gap-4"><div class="rounded-xl bg-page p-4" data-theme="light"><div class="grid grid-cols-5 gap-3"><.card :for={v <- ~w(default muted soft outline filled)} variant={v} body="seamless" size="sm"><:title>{v}</:title><:description>Quiet surface</:description><span class="text-muted">Content on the {v} surface.</span></.card></div></div><div class="rounded-xl bg-page p-4" data-theme="dark"><div class="grid grid-cols-5 gap-3"><.card :for={v <- ~w(default muted soft outline filled)} variant={v} body="seamless" size="sm"><:title>{v}</:title><:description>Quiet surface</:description><span class="text-muted">Content on the {v} surface.</span></.card></div></div></div>

Tratamentos do corpo (seamless, divided, separated, inset, flush)

seamless

Header, body, footer

Body content
Footer

divided

Header, body, footer

Body content
Footer

separated

Header, body, footer

Body content
Footer

inset

Header, body, footer

Body content
Footer

flush

Header, body, footer

Body content
Footer

seamless

Header, body, footer

Body content
Footer

divided

Header, body, footer

Body content
Footer

separated

Header, body, footer

Body content
Footer

inset

Header, body, footer

Body content
Footer

flush

Header, body, footer

Body content
Footer
.heex
<div class="flex flex-col gap-4"><div class="rounded-xl bg-page p-4" data-theme="light"><div class="grid grid-cols-5 items-start gap-3"><.card :for={b <- ~w(seamless divided separated inset flush)} variant="muted" body={b} size="sm"><:title>{b}</:title><:description>Header, body, footer</:description><:actions><.button size="xs" variant="ghost" icon="more-h" aria-label="More" /></:actions><span class="text-muted">Body content</span><:footer><span>Footer</span><.button size="xs">Save</.button></:footer></.card></div></div><div class="rounded-xl bg-page p-4" data-theme="dark"><div class="grid grid-cols-5 items-start gap-3"><.card :for={b <- ~w(seamless divided separated inset flush)} variant="muted" body={b} size="sm"><:title>{b}</:title><:description>Header, body, footer</:description><:actions><.button size="xs" variant="ghost" icon="more-h" aria-label="More" /></:actions><span class="text-muted">Body content</span><:footer><span>Footer</span><.button size="xs">Save</.button></:footer></.card></div></div></div>

Cabeçalho, ações e cantos (workspace)

Workspace

Name, plan and members.

Acme Inc.acme.example.com
Pro

Leading actions

The buttons hang into the header padding.

Equal distance from the top and side edges.
.heex
<div class="grid grid-cols-2 items-start gap-5">
  <.card body="inset" variant="muted">
    <:title>Workspace</:title>
    <:description>Name, plan and members.</:description>
    <:actions><.button size="sm" variant="outline">Edit details</.button></:actions>
    <div class="flex items-center justify-between gap-3">
      <div><b class="block text-sm text-ink">Acme Inc.</b><span class="text-xs text-muted">acme.example.com</span></div>
      <.badge color="primary" variant="soft">Pro</.badge>
    </div>
  </.card>
  <.card body="divided">
    <:actions placement="start"><.button size="sm" variant="ghost" icon="arrow-left" aria-label="Back" /></:actions>
    <:title>Leading actions</:title>
    <:description>The buttons hang into the header padding.</:description>
    <:actions><.button size="sm" variant="outline">Share</.button><.button size="sm" icon="more-h" variant="ghost" aria-label="More" /></:actions>
    <span class="text-muted">Equal distance from the top and side edges.</span>
  </.card>
</div>

Tamanhos xs a lg

xs

Padding, radius, gap and type

Body
Footer

sm

Padding, radius, gap and type

Body
Footer

md

Padding, radius, gap and type

Body
Footer

lg

Padding, radius, gap and type

Body
Footer
.heex
<div class="grid grid-cols-4 items-start gap-4">
  <.card :for={s <- ~w(xs sm md lg)} body="separated" size={s}>
    <:title>{s}</:title>
    <:description>Padding, radius, gap and type</:description>
    <:actions><.button size={if s in ~w(xs sm), do: "xs", else: "sm"} variant="outline">Edit</.button></:actions>
    <span class="text-muted">Body</span>
    <:footer><span>Footer</span></:footer>
  </.card>
</div>

Bleed: imagem e tabela de ponta a ponta

Forest pathwoodscape.png

Recent invoices

Invoice Amount
INV-001 R$ 1.200
INV-002 R$ 480
INV-003 R$ 90
.heex
<div class="grid grid-cols-2 items-start gap-5">
  <.card body="inset" variant="default">
    <:bleed><svg viewBox="0 0 400 200" preserveAspectRatio="xMidYMid slice" class="block h-40 w-full" role="img" aria-label="Forest path"><defs><linearGradient id="bleed-a" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#c9e4d6"/><stop offset="1" stop-color="#6fae8f"/></linearGradient></defs><rect width="400" height="200" fill="url(#bleed-a)"/><path d="M0 130 Q80 90 160 120 T400 100 V200 H0Z" fill="#3f8465"/><path d="M0 160 Q120 120 220 150 T400 140 V200 H0Z" fill="#2c6650"/><path d="M170 200 Q190 150 200 120 Q215 150 240 200Z" fill="#e8dcc0" opacity=".85"/><g fill="#1f4d3c"><path d="M40 150 l14 -46 l14 46Z"/><path d="M70 156 l12 -38 l12 38Z"/><path d="M320 148 l16 -52 l16 52Z"/><path d="M350 156 l12 -36 l12 38Z"/></g></svg></:bleed>
    <:footer>
      <div class="flex flex-col leading-tight"><b class="text-sm text-ink">Forest path</b><span class="text-xs">woodscape.png</span></div>
      <.button size="sm" variant="outline" icon="download" aria-label="Download" />
    </:footer>
  </.card>
  <.card body="seamless" canvas>
    <.card_header><.card_heading level={3} size="lg">Recent invoices</.card_heading></.card_header>
    <.card_body padded={false}>
      <.table id="bleed-table" bleed wrapper={false} rows={[%{id: 1, n: "INV-001", v: "R$ 1.200"}, %{id: 2, n: "INV-002", v: "R$ 480"}, %{id: 3, n: "INV-003", v: "R$ 90"}]}>
        <:col :let={r} label="Invoice">{r.n}</:col>
        <:col :let={r} label="Amount" align="right">{r.v}</:col>
      </.table>
    </.card_body>
  </.card>
</div>

Uso

<.card title="Revenue by plan">
  <:actions><.button size="sm" icon_right="arrow-up-right">Plans</.button></:actions>
  …
</.card>

Regras

  • Estrutura: .lu-card (tray, raio 20, padding 6) > header (título overline + ações) > .lu-card-b (painel, raio 14).
  • Ações do header: botão sm secundário com ↗, menu ⋯ ou segmentado.
  • Rodapé opcional fora do painel, em muted (como o delta dos KPIs).
  • Variante flat sem bandeja para listas simples.

Referência da API

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

The card of the system, styled only with Tailwind utilities: a tray (bg-tray, radius 20, 6px border) whose upper-case title hugs a panel (bg-panel, radius 14). variant="panel" drops the tray. Other variants (default, flat, bordered, outline, muted, soft, filled, solid, glow, gradient, gradient_outline, plus the aliases canvas = flat and page = default) are plain surfaces; the surface flat is the sunken, borderless one (title in a <b>, content as given), tinted by color or gradient.

<.card title="Revenue by plan">
  <:actions><.button size="sm" variant="outline" trailing_icon="huge-arrow-up-right">Plans</.button></:actions>
  ...
  <:footer>trailing 12 mo</:footer>
</.card>

<.card variant="solid" color="primary"><:title>Primary</:title>Faturamento</.card>
<.card variant="gradient" gradient="sky-blue">...</.card>

The title is title="text" or the <:title> slot (markup, class allowed); <:title_extra> goes beside it (a badge, a counter). With canvas the card is the bare tray and its content is the parts card_header/1, card_body/1 and card_footer/1:

<.card canvas>
  <.card_header>
    <.card_heading level={3}>Profile</.card_heading>
    <.card_actions>...</.card_actions>
  </.card_header>
  <.card_body>...</.card_body>
  <.card_footer>All changes saved</.card_footer>
</.card>

navigate, patch or href make the whole card a link (a surface), a row that ends in an arrow. size (xs/sm/lg), shape="xl" and padded={false} act on the surfaces and the tray root.

<.card>

Attr Type Default Values / notes
variant :string "tray" tray, panel, default, flat, canvas, page, bordered, outline, muted, soft, filled, solid, glow, gradient, gradient_outline
size :string "md" xs, sm, md, lg - Padding of a surface.
color :string "primary" nil, primary, secondary, info, success, warning, error - Tint of soft, filled, solid, glow.
gradient :string "purple-indigo" nil, amber-orange, fuchsia-pink, green-fuchsia, purple-indigo, sky-blue
shape :string "rounded" rounded, xl
padded :boolean true
canvas :boolean false The bare tray: the content is card_header/1, card_body/1, card_footer/1.
body :string "seamless" seamless, divided, separated, inset, flush - Reserved: the design has no styles for the body modes yet.
divider :string "full" full, inset - Reserved (see body).
highlight :boolean true Reserved (see body).
navigate :string nil
patch :string nil
href :string nil
arrow :boolean true The chevron of a link card.
body_padded :boolean true false drops the body panel's 16px padding.
body_class :any nil Classes of the body panel (the tray).
class :any nil

Any other HTML/phx attribute goes to the root element, including target, rel, download, replace, method.

Slots:

  • <:actions> - At the end of the header.
  • <:footer>
  • <:inner_block>
  • <:title> - attrs: class - The heading as markup (title="text" is the same as text).
  • <:title_extra> - Beside the title (a badge, a counter).

<.card_header>

Attr Type Default Values / notes
size :string "md" xs, sm, md, lg, xl - lg and xl are taller.
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_heading>

Attr Type Default Values / notes
size :string "base" base, lg, xl
level :integer 2 1, 2, 3, 4, 5, 6
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_subheading>

Attr Type Default Values / notes
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_actions>

Attr Type Default Values / notes
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_body>

Attr Type Default Values / notes
padded :boolean true false drops the 16px padding (tables, media).
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_footer>

Attr Type Default Values / notes
align :string nil nil, start, center, end, between
size :string nil nil, xs, sm, md, lg - Reserved: no styles in the design.
class :any nil

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

Slots:

  • <:inner_block> (required)

<.card_bleed>

Content that bleeds to the card's edges (negative margin of the padding --card-p, 16px).

Attr Type Default Values / notes
class :any nil

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

Slots:

  • <:inner_block> (required)