54 — Data display
Timeline
Things that happened, in order, each with its mark, a title, when, and what.
- Embryo transferOne blastocyst, day 5, grade 4AA.
- ThawingSurvived the thaw, fully re-expanded.
- Consent signed
Installation
pnpm dlx @human-kit/design add timelinenpx @human-kit/design add timelineyarn dlx @human-kit/design add timelinebunx @human-kit/design add timelineThe command copies the files to src/lib/components/ui/timeline. It also
installs the packages that the files import.
Usage
<script lang="ts">
import * as Timeline from '$lib/components/ui/timeline';
</script>
<Timeline.Root>
<Timeline.Item title="Embryo transfer" time="26 Nov, 9:30" datetime="2026-11-26T09:30" tone="green">
One blastocyst, day 5.
</Timeline.Item>
<Timeline.Item title="Consent signed" time="20 Nov" datetime="2026-11-20" />
</Timeline.Root> Examples
Variants
- TransferDay 5, 4AA.
- Thaw
- Consent
- TransferDay 5, 4AA.
- Thaw
- Consent
- TransferDay 5, 4AA.
- Thaw
- Consent
Guidelines
- Use a timeline for things that already happened, in order: the history of a record, the steps of a treatment so far. For steps still to come, use a
Stepper.Root. - Put the newest event first when the reader comes for the latest news; the oldest first when the story reads from its start. Keep one order across the app.
- Give
tonefor what the event means in the app, the same tone as its badge elsewhere. Leave the plain grey for events that need no colour. - Use
iconwhen the kind of event matters more than its state: a call, a note, a payment. Icons and dots can mix in one list. - Use
ghost, the default, in the flow of a page or inside something that already frames it, such as a card, a dialog or a side panel. Useoutlinefor a history that stands on the page as a card of its own, andfilledfor one that should read lighter than a card, beside filled fields. - Keep the title to a few words and the description to a line or two. A long text belongs on the page the event links to.
Accessibility
- It renders an
<ol>of<li>: a screen reader says how many events there are and which one it is on. - The time is a
<time>element; givedatetimein ISO so machines read the moment the text shows. - The dots, the icons and the line are hidden from assistive technology. The tone is colour alone, so say in the title what it means when it matters.
- It takes no focus of its own. A link or a button in a description is reached with
Tabas usual.
API reference
Timeline.Root
| Prop | Type | Default |
|---|---|---|
variant | 'ghost' | 'outline' | 'filled' What the list stands on: nothing, a white card of its own, or a soft grey panel with no edge. The dots and the icon tiles are the same in all three. | 'ghost' |
Plus every attribute of an <ol>.
Timeline.Item
| Prop | Type | Default |
|---|---|---|
title | string What happened, in a few words. Required. | — |
time | string When it happened, as shown: "12 Mar, 9:30". | — |
datetime | string The same moment in ISO, | — |
tone | 'gray' | 'blue' | 'cyan' | 'teal' | 'green' | 'amber' | 'orange' | 'red' | 'pink' | 'violet' The colour of the dot, from the badge tones. | 'gray' |
icon | Snippet A small icon on a round tile, in place of the dot. | — |
children | Snippet The description, under the title. | — |
Plus every attribute of an <li>.