Skip to the content
human-kit design
54 — Data display

Timeline

Things that happened, in order, each with its mark, a title, when, and what.

  1. Embryo transfer
    One blastocyst, day 5, grade 4AA.
  2. Thawing
    Survived the thaw, fully re-expanded.
  3. Consent signed

Installation

pnpm dlx @human-kit/design add timeline
npx @human-kit/design add timeline
yarn dlx @human-kit/design add timeline
bunx @human-kit/design add timeline

The 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

  1. Transfer
    Day 5, 4AA.
  2. Thaw
  3. Consent
  1. Transfer
    Day 5, 4AA.
  2. Thaw
  3. Consent
  1. Transfer
    Day 5, 4AA.
  2. Thaw
  3. 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 tone for 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 icon when 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. Use outline for a history that stands on the page as a card of its own, and filled for 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; give datetime in 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 Tab as usual.

API reference

Timeline.Root

PropTypeDefault
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

PropTypeDefault
titlestring

What happened, in a few words. Required.

—
timestring

When it happened, as shown: "12 Mar, 9:30".

—
datetimestring

The same moment in ISO, 2026-03-12T09:30, for the <time> element.

—
tone'gray' | 'blue' | 'cyan' | 'teal' | 'green' | 'amber' | 'orange' | 'red' | 'pink' | 'violet'

The colour of the dot, from the badge tones.

'gray'
iconSnippet

A small icon on a round tile, in place of the dot.

—
childrenSnippet

The description, under the title.

—

Plus every attribute of an <li>.