Timeline
marcador solid · outline · icon · avatar · ponto · size md–2xl · density · color (8) · tone
Histórico cronológico de eventos de uma conta ou caso.
Eventos chegando em ordem
<.timeline marker="icon" loop><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}])} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline>
variant do marcador solid · outline · icon · avatar · line (ponto)
<div class="grid grid-cols-5 gap-3.5"><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted"></span><.timeline ><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">outline</span><.timeline marker="outline"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">icon</span><.timeline marker="icon"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">avatar</span><.timeline marker="avatar"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.avatar color="t1" size="28">{Enum.at(~w(Na Sa Ce), n)}</.avatar></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">dot</span><.timeline marker="dot"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}></.timeline_item></.timeline></div></div>
size md · lg · xl · 2xl · density compact
<div class="grid grid-cols-5 gap-3.5"><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">md</span><.timeline ><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 2))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">lg</span><.timeline size="lg"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 2))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">xl</span><.timeline size="xl"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 2))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">2xl</span><.timeline size="2xl"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 2))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div><div class="flex flex-col gap-1.5"><span class="font-mono text-xs text-muted">compact</span><.timeline density="compact"><.timeline_item :for={{{c, i, t, d, h}, n} <- Enum.with_index(Enum.take([{"success", "check", "NF-e 48.211 autorizada", "Protocolo 129 2611", "14:02"}, {"info", "truck", "Saiu para entrega", "Motorista: Rita", "14:40"}, {"warning", "alert", "Cliente ausente", "Nova tentativa às 16h", "15:10"}, {"success", "check-circle", "Entregue", "Assinado por Ana", "16:05"}], 3))} color={c} title={t} description={d} time={h} style={"--dl:#{Float.round(n * 0.6, 1)}s"}><:point><.icon name={i} size="sm" /></:point></.timeline_item></.timeline></div></div>
color (8)
<div class="flex flex-wrap items-center gap-2.5"><span :for={c <- ~w(neutral primary secondary info success warning error dark)} class={LedgerUI.Color.vars(c)} style="display:inline-grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--c);color:var(--c-on)"><.icon name="check" size="sm" /></span></div>
Valores da API que completam a paridade
<div class="grid grid-cols-5 gap-3.5"><div class="flex flex-col items-start gap-1.5"><.chip>espaçamento normal</.chip><span class="font-mono text-[11px] text-muted">density=default</span></div><div class="flex flex-col items-start gap-1.5"><.chip>canvas</.chip><span class="font-mono text-[11px] text-muted">variant=canvas</span></div><div class="flex flex-col items-start gap-1.5"><span class={LedgerUI.Color.vars("primary")} style="display:inline-grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--c);color:var(--c-on)"><.icon name="check" size="sm" /></span><span class="font-mono text-[11px] text-muted">color=accent</span></div><div class="flex flex-col items-start gap-1.5"><.badge canvas>Entregue</.badge><span class="font-mono text-[11px] text-muted">tone=default</span></div><div class="flex flex-col items-start gap-1.5"><.badge canvas color="warning">Atrasado</.badge><span class="font-mono text-[11px] text-muted">tone=warn</span></div></div>
Uso
<.timeline items={@events} />
Regras
- Ícone 32px em caixa tonal; linha de 1px
line-strongliga os eventos.
Referência da API
Todos os function components, atributos, valores e slots que este componente cobre.
Events down a line, each marked by a filled, outlined, icon or avatar point.
<.timeline marker="icon" size="lg">
<.timeline_item title="NF-e autorizada" description="Protocolo 129 2611" time="14:02" color="success">
<:point><.icon name="check" size="sm" /></:point>
</.timeline_item>
</.timeline>
The items can come from a list or a stream through rows and the :item slot, which gets
{dom_id, row} (given a stream, the list renders with phx-update="stream" and needs an id):
<.timeline id="events" rows={@streams.events}>
<:item :let={{id, event}}>
<.timeline_item id={id} title={event.title} time={event.ago} color={event.color} />
</:item>
</.timeline>
variant="canvas" is a list of timeline_events, each with a boxed icon tile, a title over a
subtitle and the time at the right.
Styled only with Tailwind utilities. The marker look (solid, outline, icon, avatar, dot)
belongs to the whole line, so it is set on the timeline with marker (the root carries
data-lu-marker and the items read it through group-data-[lu-marker=...]/tl:); the item's
variant only decides what its point holds. loop plays the canvas loop (mo-stg): each item
fades in, stays and leaves, staggered by its own --dl delay (style="--dl:0.6s").
<.timeline>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
line_space |
:boolean |
false |
Leaves a gap between the points and the line. |
size |
:string |
"md" |
md, lg, xl, 2xl |
density |
:string |
"default" |
default, compact |
variant |
:string |
"line" |
line, canvas |
marker |
:string |
"solid" |
solid, outline, icon, avatar, dot - The look of the points of a line timeline. |
loop |
:boolean |
false |
The canvas loop (mo-stg): the items fade in one after the other, forever. |
items |
:list |
[] |
Points as data, before the inner block: maps with :title and optionally :time, :description, :color, :variant (solid, outline, icon, avatar) and :ping, one timeline_item/1 each. |
id |
:string |
nil |
Required with a stream. |
rows |
:any |
nil |
A list or a stream of rows rendered by the :item slot. |
row_id |
:any |
nil |
A function from a row to its DOM id, for a plain list. |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:inner_block><:item>- Renders one row; gets{dom_id, row}.
<.timeline_item>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title |
:string |
nil |
|
time |
:string |
nil |
|
description |
:string |
nil |
|
color |
:string |
"neutral" |
accent, dark, error, info, neutral, primary, secondary, success, warning |
variant |
:string |
"solid" |
solid, outline, icon, avatar |
point_class |
:any |
nil |
|
ping |
:boolean |
false |
|
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:details>- The description with markup; replacesdescription.<:inner_block><:point>- What the point shows, usually an icon.
<.timeline_event>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
title |
:string |
nil |
|
subtitle |
:string |
nil |
|
time |
:string |
nil |
|
tone |
:string |
"default" |
acc, default, info, neg, pos, warn |
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.
Slots:
<:icon>- The icon inside the tile.<:inner_block>- Free content after the title and the subtitle.
<.timeline_day>
| Attr | Type | Default | Values / notes |
|---|---|---|---|
label (required) |
:string |
||
class |
:any |
nil |
Any other HTML/phx attribute goes to the root element.