sveltelean Primitives
Version v0.18.0
Deployments, newest first
  1. Maintenance window

    Scheduled
  2. Deployed to production

    Release 0.4.0 by Ada

  3. Deployment failed

    Health check timed out; rolled back

  4. Build started

Code
<script lang="ts">
	import '@svelte-lean/styles/timeline.css';
</script>

<ol role="list" data-slean="timeline" aria-label="Deployments">
	<li>
		<time datetime="2026-10-02">2 Oct</time>
		<p data-slean-part="title">Maintenance window</p>
		<span data-slean-part="pending">Scheduled</span>
	</li>
	<li data-color="success">
		<time datetime="2026-09-28T09:12">28 Sep, 09:12</time>
		<p data-slean-part="title">Deployed to production</p>
		<p data-slean-part="description">Release 0.4.0 by Ada</p>
	</li>
	<li data-color="error">
		<time datetime="2026-09-27T17:40">27 Sep, 17:40</time>
		<p data-slean-part="title">Deployment failed</p>
		<p data-slean-part="description">Health check timed out; rolled back</p>
	</li>
	<li>
		<time datetime="2026-09-27T17:31">27 Sep, 17:31</time>
		<p data-slean-part="title">Build started</p>
	</li>
</ol>
Markup and CSS only; the dots and the line are generated content on each list item.

Examples

Oldest first

Order 1042
  1. Order placed

  2. Payment retried

    The first attempt was declined; the second went through.

  3. Shipped

  4. Delivery

    Expected
Code
<ol role="list" data-slean="timeline" aria-label="Order 1042">
	<li data-color="info">
		<time datetime="2026-09-24T10:02">24 Sep, 10:02</time>
		<p data-slean-part="title">Order placed</p>
	</li>
	<li data-color="warning">
		<time datetime="2026-09-25T08:40">25 Sep, 08:40</time>
		<p data-slean-part="title">Payment retried</p>
		<p data-slean-part="description">The first attempt was declined; the second went through.</p>
	</li>
	<li data-color="success">
		<time datetime="2026-09-26T15:15">26 Sep, 15:15</time>
		<p data-slean-part="title">Shipped</p>
	</li>
	<li>
		<time datetime="2026-09-30">30 Sep</time>
		<p data-slean-part="title">Delivery</p>
		<span data-slean-part="pending">Expected</span>
	</li>
</ol>
With the oldest event first, the line into the first pending event is dashed as well.

Activity feed

Pull request 218
  1. Release

    Scheduled
  2. Approved by Lin

  3. Changes requested

  4. Pull request opened

Code
<script lang="ts">
	import '@svelte-lean/styles/button.css';

	type Event = { id: number; at: Date; title: string; color?: string; pending?: boolean };

	let events: Event[] = $state([
		{ id: 4, at: new Date('2027-01-15T09:00Z'), title: 'Release', pending: true },
		{ id: 3, at: new Date('2026-10-02T16:45Z'), title: 'Approved by Lin', color: 'success' },
		{ id: 2, at: new Date('2026-10-02T10:20Z'), title: 'Changes requested', color: 'warning' },
		{ id: 1, at: new Date('2026-10-01T09:05Z'), title: 'Pull request opened', color: 'info' }
	]);
	const format = new Intl.DateTimeFormat('en', {
		dateStyle: 'medium',
		timeStyle: 'short',
		timeZone: 'UTC'
	});

	function comment() {
		events.splice(1, 0, { id: events.length + 1, at: new Date(), title: 'Comment added' });
	}
</script>

<ol role="list" data-slean="timeline" aria-label="Pull request 218">
	{#each events as event (event.id)}
		<li data-color={event.color}>
			<time datetime={event.at.toISOString()}>{format.format(event.at)}</time>
			<p data-slean-part="title">{event.title}</p>
			{#if event.pending}<span data-slean-part="pending">Scheduled</span>{/if}
		</li>
	{/each}
</ol>
<button type="button" class="add" data-slean="button" data-variant="outlined" data-color="neutral" data-size="small"
	onclick={comment}>
	Add a comment
</button>

<style>
	.add {
		margin-top: 1rem;
	}
</style>
Rendered from data with Intl.DateTimeFormat; the button inserts an event.

Usage

Plain markup with a stylesheet: install @svelte-lean/styles. No JavaScript runs.

npm install @svelte-lean/styles
stylesheets
import '@svelte-lean/styles/timeline.css';

One <li> per event with a <time datetime>, an optional title and description, and role="list" on the <ol> so Safari keeps announcing it as a list. data-color="info", "success", "warning" or "error" tints a dot; say the outcome in the title.

Put the pending part in every event that has not happened yet. No event is marked current: a timeline records events, it does not track a position in a task (that is Steps).

Anatomy

PartElementdata-slean-partRequiredNotes
root<ol role="list" data-slean="timeline">–yesrole="list" keeps the list announced in Safari. Named with aria-label when useful.
event<li> with <time datetime>–yesdata-color="info|success|warning|error" tints the dot; the text says what happened.
title<p> or <span>titlenoWhat happened.
description<p> or <span>descriptionnoDetails in the muted color.
pending<span> with textpendingyesIn every event that has not happened yet. Visible; its presence draws the hollow dot.

Keyboard

KeyWhenResult
Tablinks inside eventsMoves between them (native); the timeline is not focusable

Styling

timeline.css draws the dot and the line from each item’s pseudo-elements, the colors, the time, title and description text, and the pending state. The tokens it reads:

TokenDefault (light)Applies to
--slean-fgvar(--slean-neutral-12)color
--slean-text-sm0.875remfont-size
--slean-space-5calc(var(--slean-spacing) * 5)padding-block-end
--slean-border-strongvar(--slean-neutral-8)border, background
--slean-space-1calc(var(--slean-spacing) * 1)inset-block-start, inset-block-end, margin-block-start
--slean-bordervar(--slean-neutral-6)border-inline-start
--slean-fg-mutedvar(--slean-neutral-11)color
--slean-text-xs0.75remfont-size
--slean-font-weight-medium500font-weight
--slean-space-2calc(var(--slean-spacing) * 2)padding-inline
--slean-radius-full9999pxborder-radius
--slean-color-mainvar(--slean-primary-main)border-color, background

State selectors the stylesheet targets, all from the platform or ARIA: :last-child.

Variant attributes: data-color (neutral).

Under the hood

Runtime and size
Tier
0 · Native
Behavior JS
0 B brotli · 0 B gzip · fixtures/results.json (native-only) · method
Platform features
<ol>, <time datetime>, :has()
Shared listeners
none
Per-instance listeners
none
Lazy state
none
Native base
<ol> of <li> events with <time datetime>

Tier 0: no behavior module; the Vite plugin maps timeline to nothing and the page ships no Svelte Lean JavaScript for it.

Why this implementation

A history is a list of events in order. <ol> gives each event its position, and <time datetime> gives its date in a form software can read while the text shows it the way the reader expects.

Markup usually loses the “not yet” state. Here a pending event contains visible text such as “Scheduled”; timeline.css reads that element through :has() to draw a hollow dot and a dashed line, so what is seen and what is read come from one place. Tones tint the dots only; the text says what happened.

The browser owns

  • the ordered list and each event’s position
  • the machine-readable date in <time datetime>
  • the pending text, read with the event

Svelte Lean owns

  • timeline.css: the dots, the line, the colors, the hollow pending dot and dashed line
  • the contract: one element that both says and shows that an event is pending
  • documentation
Accessibility
  • An <ol> with role="list": screen readers announce the list and each event’s position, in Safari as well.
  • <time datetime> carries the exact date; its text is what the reader sees and hears.
  • The pending text is read with the event; the hollow dot is drawn from it.
  • The colors are color only and never the only signal: the title says what happened.
Platform features
FeatureBaselineOutside the target
<ol>, <time datetime>Widely availableNot applicable
:has()Baseline 2023A pending event looks like a past one; its text is still read
Without JavaScript

Fully functional: the list, its dates and its states are markup.

Server rendering and hydration

Static markup: the server renders the events, their dates and the pending text. Format the dates on the server in the reader’s language.

Nothing is attached; the timeline reads the same before and after hydration.

Compatibility

:has() is Baseline 2023, widely available. Without it a pending event looks like a past one, and its text is still read.

Tests and source