06 · Exibição

DescriptionList

cols 1–4 · layout stacked/inline

Lista de pares rótulo e valor para detalhes de uma entidade.

Dados carregando em sequência

Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
.heex
<.description_list cols={3} class="[&>*]:animate-[mo-stg_6s_cubic-bezier(.2,.8,.2,1)_infinite] [&>*]:[animation-delay:var(--dl,0s)]"><:item :for={{l, v, d} <- [{"Razão social", "Mercadinho Bom Preço Ltda", "0.00s"}, {"CNPJ", "12.345.678/0001-90", "0.25s"}, {"Regime", "Simples Nacional", "0.50s"}, {"Cidade", "Feira de Santana · BA", "0.75s"}, {"Desde", "jan 2024", "1.00s"}, {"Limite", "R$ 15.000,00", "1.25s"}]} label={l} wrapper_style={"--dl:#{d}"}>{v}</:item></.description_list>

cols 1–4 · layout stacked × inline

cols=1
Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
cols=2
Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
cols=3
Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
cols=4
Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
layout=inline
Razão social
Mercadinho Bom Preço Ltda
CNPJ
12.345.678/0001-90
Regime
Simples Nacional
Cidade
Feira de Santana · BA
Desde
jan 2024
Limite
R$ 15.000,00
.heex
<div class="flex flex-col gap-4"><div :for={{label, cols, layout} <- [{"cols=1", 1, "stacked"}, {"cols=2", 2, "stacked"}, {"cols=3", 3, "stacked"}, {"cols=4", 4, "stacked"}, {"layout=inline", 2, "inline"}]} class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">{label}</span><.description_list cols={cols} layout={layout} class="my-3.5"><:item :for={{l, v, d} <- [{"Razão social", "Mercadinho Bom Preço Ltda", "0.00s"}, {"CNPJ", "12.345.678/0001-90", "0.25s"}, {"Regime", "Simples Nacional", "0.50s"}, {"Cidade", "Feira de Santana · BA", "0.75s"}, {"Desde", "jan 2024", "1.00s"}, {"Limite", "R$ 15.000,00", "1.25s"}]} label={l} wrapper_style={"--dl:#{d}"}>{v}</:item></.description_list></div></div>

Uso

<.list><:item title="Plano">Pro</:item>…</.list>

Regras

  • Rótulo em muted 13px; valor em ink; números tabulares.

Referência da API

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

Label and value pairs in a grid, as the canvas description list: the label small and faint, the value in the ink colour. For the short data of a detail (an order, a client). Styled only with Tailwind utilities.

<.description_list cols={2}>
  <:item label="Razão social">Mercadinho Bom Preço Ltda</:item>
  <:item label="CNPJ" mono>12.345.678/0001-90</:item>
</.description_list>

cols is 1 to 4. layout="inline" puts the label at the left and the value at the right. An item with no content shows empty ("—"). An item takes id, class and style for its <dd>, and wrapper_id, wrapper_class and wrapper_style for the <div> around the pair.

<.description_list>

Attr Type Default Values / notes
cols :integer 2 1, 2, 3, 4
layout :string "stacked" stacked, inline
variant :string nil nil, stacked, inline - The same as layout; it wins when given.
empty :string "—"
class :any nil
style :string nil

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

Slots:

  • <:item> (required) - attrs: label, title, mono, id, class, style, wrapper_id, wrapper_class, wrapper_style - A pair: label, and the value as content.