Skip to content
Likable Aurora @likable-hair/svelte 5

Timeline

Events in time order: a marker on a line for each item, with its date or time, title and description. One column by default; alternate places the items on both sides of the line with the dates on the other side, and falls back to one column when the timeline is narrower than 640px. status marks an item as done, current or upcoming, icon and variant change its marker, groupBy adds a heading for each day, variant="card" puts every item in a card. Dates follow locale; the items are shown in the given order. Its state is exposed as data-variant, data-layout, data-marker-alignment and, on each item, data-status, data-variant and data-side for app CSS.

import { Timeline } from '@likable-hair/svelte';

src/lib/components/simple/timeline/Timeline.svelte · Markdown for LLMs

Progress

status marks each item as done, current or upcoming: done markers are filled, the current one pulses and is announced with aria-current="step", upcoming ones stay empty. time shows a free label instead of the dates.

  1. Check-in

    The client arrived at the salon

    Completed
  2. Color applied

    6.3 with 20 vol. developer

    Completed
  3. Now
    Processing

    12 minutes left

    In progress
  4. Blow-dry and payment
    Upcoming
Code
<script lang="ts">
	import { Timeline, type TimelineItem } from '@likable-hair/svelte';

	const items: TimelineItem[] = [
		{
			title: 'Check-in',
			description: 'The client arrived at the salon',
			from: new Date(2026, 8, 24, 9, 30),
			status: 'done'
		},
		{
			title: 'Color applied',
			description: '6.3 with 20 vol. developer',
			from: new Date(2026, 8, 24, 9, 40),
			status: 'done'
		},
		{ title: 'Processing', description: '12 minutes left', time: 'Now', status: 'current' },
		{ title: 'Blow-dry and payment', from: new Date(2026, 8, 24, 10, 30), status: 'upcoming' }
	];
</script>

<div class="demo">
	<Timeline {items} />
</div>

<style>
	.demo {
		width: min(100%, 420px);
	}
</style>

Dates and ranges

from and to take a Date, an ISO string or a timestamp. Dates follow locale: day, short month and year, plus the time when it is not midnight; with to the timeline shows a range. dateFormat takes Intl.DateTimeFormat options for a different format.

  1. Contratto firmato
  2. Sopralluogo
  3. 14–25 set 2026
    Lavori
  4. 2 ott 2026, 09:00–12:30
    Collaudo
  1. Contratto firmato
  2. Sopralluogo
  3. Mon, September 14 – Fri, September 25
    Lavori
  4. Fri, October 2
    Collaudo
Code
<script lang="ts">
	import { Timeline, type TimelineItem } from '@likable-hair/svelte';

	const items: TimelineItem[] = [
		{ title: 'Contratto firmato', from: new Date(2026, 8, 1) },
		{ title: 'Sopralluogo', from: '2026-09-07T15:00:00' },
		{ title: 'Lavori', from: new Date(2026, 8, 14), to: new Date(2026, 8, 25) },
		{ title: 'Collaudo', from: new Date(2026, 9, 2, 9, 0), to: new Date(2026, 9, 2, 12, 30) }
	];
</script>

<div class="columns">
	<Timeline {items} locale="it" />
	<Timeline {items} locale="en-US" dateFormat={{ weekday: 'short', day: 'numeric', month: 'long' }} />
</div>

<style>
	.columns {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
		gap: 32px;
		width: min(100%, 640px);
	}
</style>

Icons and colors

icon puts an SVG path in the marker, which grows to fit it; variant colors it (success, warning, error, neutral). They combine with status: a done or current marker is filled.

  1. Order placed
    Completed
  2. Payment confirmed
    Completed
  3. Packed
    Completed
  4. Delivery delayed

    The courier missed the pickup; new estimate tomorrow.

    Completed
  5. Out for delivery
    In progress
  6. Delivered
    Upcoming
Code
<script lang="ts">
	import {
		mdiAlertCircleOutline,
		mdiCheck,
		mdiCreditCardOutline,
		mdiHomeOutline,
		mdiPackageVariantClosed,
		mdiTruckDeliveryOutline
	} from '@mdi/js';
	import { Timeline, type TimelineItem } from '@likable-hair/svelte';

	const items: TimelineItem[] = [
		{ title: 'Order placed', from: new Date(2026, 8, 21, 18, 12), icon: mdiCheck, status: 'done' },
		{
			title: 'Payment confirmed',
			from: new Date(2026, 8, 21, 18, 13),
			icon: mdiCreditCardOutline,
			variant: 'success',
			status: 'done'
		},
		{
			title: 'Packed',
			from: new Date(2026, 8, 22, 11, 40),
			icon: mdiPackageVariantClosed,
			status: 'done'
		},
		{
			title: 'Delivery delayed',
			description: 'The courier missed the pickup; new estimate tomorrow.',
			from: new Date(2026, 8, 23, 9, 5),
			icon: mdiAlertCircleOutline,
			variant: 'warning',
			status: 'done'
		},
		{
			title: 'Out for delivery',
			from: new Date(2026, 8, 24, 8, 30),
			icon: mdiTruckDeliveryOutline,
			status: 'current'
		},
		{ title: 'Delivered', icon: mdiHomeOutline, variant: 'neutral', status: 'upcoming' }
	];
</script>

<div class="demo">
	<Timeline {items} locale="en-GB" />
</div>

<style>
	.demo {
		width: min(100%, 420px);
	}
</style>

Grouped by day

groupBy="day" adds a heading before the items of each day and shows only their times. A function instead returns the heading of each item; consecutive items with the same heading share it.

Tuesday, 22 September 2026
  1. Ticket opened

    Printer offline

  2. Assigned to Giulia
Wednesday, 23 September 2026
  1. Technician on site
  2. Spare part ordered
Thursday, 24 September 2026
  1. Ticket closed

    Fuser replaced

Code
<script lang="ts">
	import { Timeline, type TimelineItem } from '@likable-hair/svelte';

	const items: TimelineItem[] = [
		{ title: 'Ticket opened', description: 'Printer offline', from: new Date(2026, 8, 22, 9, 12) },
		{ title: 'Assigned to Giulia', from: new Date(2026, 8, 22, 9, 40) },
		{ title: 'Technician on site', from: new Date(2026, 8, 23, 14, 0) },
		{ title: 'Spare part ordered', from: new Date(2026, 8, 23, 16, 25) },
		{ title: 'Ticket closed', description: 'Fuser replaced', from: new Date(2026, 8, 24, 11, 5) }
	];
</script>

<div class="demo">
	<Timeline {items} groupBy="day" locale="en-GB" />
</div>

<style>
	.demo {
		width: min(100%, 420px);
	}
</style>

Cards, aside and actions

variant="card" puts the content of each item in a card. asideSnippet sits next to the title, on the far side; appendSnippet goes under the description, for actions or details.

  1. Deposit €1,200.00

    Bank transfer

    Paid
  2. Second installment €800.00

    Card ending 4242

    Paid
  3. Balance €450.00
    Due
Code
<script lang="ts">
	import { mdiPencilOutline, mdiTrashCanOutline } from '@mdi/js';
	import { Button, Chip, Timeline, type TimelineItem } from '@likable-hair/svelte';

	type Payment = { amount: number; state: 'paid' | 'due' };

	const items: TimelineItem<Payment>[] = [
		{
			title: 'Deposit',
			description: 'Bank transfer',
			from: new Date(2026, 8, 3),
			data: { amount: 1200, state: 'paid' }
		},
		{
			title: 'Second installment',
			description: 'Card ending 4242',
			from: new Date(2026, 8, 17),
			data: { amount: 800, state: 'paid' }
		},
		{ title: 'Balance', from: new Date(2026, 9, 1), data: { amount: 450, state: 'due' } }
	];

	const euro = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'EUR' });
</script>

<div class="demo">
	<Timeline {items} variant="card" locale="en-GB">
		{#snippet asideSnippet({ item })}
			<span class="amount">{euro.format(item.data?.amount ?? 0)}</span>
		{/snippet}
		{#snippet appendSnippet({ item })}
			<div class="actions">
				<Chip variant={item.data?.state === 'paid' ? 'success' : 'warning'}>
					{item.data?.state === 'paid' ? 'Paid' : 'Due'}
				</Chip>
				<Button buttonType="text" size="sm" icon={mdiPencilOutline}>Edit</Button>
				<Button buttonType="text" size="sm" variant="danger" icon={mdiTrashCanOutline}>Delete</Button>
			</div>
		{/snippet}
	</Timeline>
</div>

<style>
	.demo {
		width: min(100%, 480px);
	}

	.amount {
		font-weight: 600;
		font-variant-numeric: tabular-nums;
	}

	.actions {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 4px;
	}
</style>

Alternate sides

alternate places the items on both sides of the line, with the dates on the other side. Below 640px of width the timeline falls back to one column.

  1. Founded

    Two chairs in a garage

  2. First salon

    Via Roma, Turin

  3. Online booking

    40% of appointments in the first year

  4. Third salon

    Milan, Porta Nuova

Code
<script lang="ts">
	import { Timeline, type TimelineItem } from '@likable-hair/svelte';

	const items: TimelineItem[] = [
		{ title: 'Founded', description: 'Two chairs in a garage', from: new Date(2018, 2, 1) },
		{ title: 'First salon', description: 'Via Roma, Turin', from: new Date(2019, 4, 15) },
		{ title: 'Online booking', description: '40% of appointments in the first year', from: new Date(2021, 0, 10) },
		{ title: 'Third salon', description: 'Milan, Porta Nuova', from: new Date(2024, 8, 2) }
	];
</script>

<Timeline {items} alternate locale="en-GB" dateFormat={{ month: 'long', year: 'numeric' }} />

Empty

Without items the timeline shows a small empty state; empty changes its text and emptySnippet replaces it.

No activity on this ticket yet

Code
<script lang="ts">
	import { Timeline } from '@likable-hair/svelte';
</script>

<Timeline items={[]} empty="No activity on this ticket yet" />

Props

NameTypeDefaultDescription
items requiredTimelineItem<Data>[]The events, shown in this order: the timeline does not sort them.
alternate booleanfalsePlaces the items on alternate sides of the line, with the dates on the other side. Below 640px of width the timeline falls back to one column.
variant 'plain' | 'card''plain'card puts the content of each item in a card.
markerAlignment 'top' | 'center' | 'bottom''top'Where the marker sits next to the content: on the first line (top), in the middle or on the last line.
groupBy 'day' | ((item: TimelineItem<Data>, index: number) => string)Adds a heading before each run of items in the same group: day groups by the day of from (or to) and then shows only the times, a function returns the heading of each item.
dateFormat Intl.DateTimeFormatOptionsFormat of the dates, as Intl.DateTimeFormat options. Defaults to day, short month and year, plus hours and minutes when the time is not midnight.
empty stringText shown when items is empty. Defaults to "No events yet", in the language of locale.
locale stringBCP 47 locale of the texts and of the dates: it and en are built in, other languages fall back to English. Defaults to the one set with setDefaultLocale, else en.
class string''Extra classes on the root element.
timelineElement bindable HTMLDivElementThe root element.

It also accepts the native attributes and events of <div> (for example id, title, aria-label, onkeydown), which are forwarded to the element.

Snippets

NameParametersDescription
itemSnippet{ item: TimelineItem<Data>; index: number; side: 'start' | 'end' }Replaces everything next to the marker: dates, title, description and the other snippets. side is where the content sits, end in one column.
markerSnippet{ item: TimelineItem<Data>; index: number }Replaces the marker on the line.
timeSnippet{ item: TimelineItem<Data>; text: string }Replaces the dates or the time text; text is what the timeline would show.
contentSnippet{ item: TimelineItem<Data>; index: number; side: 'start' | 'end' }Replaces title, asideSnippet and description, keeping the dates and appendSnippet.
titleSnippet{ item: TimelineItem<Data> }Replaces the title.
descriptionSnippet{ item: TimelineItem<Data> }Replaces the description.
asideSnippet{ item: TimelineItem<Data> }Content next to the title, on the far side, such as an amount or a badge.
appendSnippet{ item: TimelineItem<Data>; index: number }Content under the description, such as actions or details.
groupSnippet{ label: string; items: TimelineItem<Data>[] }Replaces the heading of a group made by groupBy.
emptySnippetReplaces the empty state.

Types

Exported by the package: import type { TimelineItem } from '@likable-hair/svelte';

TimelineItem

One event of a Timeline.

interface TimelineItem<Data = unknown>

NameTypeDescription
key string | numberUnique key of the item in the list. Defaults to its position.
title requiredstringMain text of the item.
description stringSecondary text under the title.
from Date | string | numberWhen the event happens or starts: a Date, an ISO string or a timestamp (a luxon DateTime works too). The time is shown when it is not midnight.
to Date | string | numberWhen the event ends. Shown after from as a range, such as "24–26 Sep 2026".
time stringFree text shown instead of the dates, such as "Now" or "09:30".
status 'done' | 'current' | 'upcoming'Progress of the item: done fills the marker, current fills it with the accent color, makes it pulse and sets aria-current="step", upcoming leaves it empty. Screen readers read it after the title.
icon stringSVG path of an icon inside the marker, which grows to fit it.
variant 'primary' | 'success' | 'warning' | 'error' | 'neutral'Color of the marker. Defaults to the primary color, and to the accent color for the current item.
data DataAny app data, passed back to the snippets.

CSS variables

For a single instance, pass them as style props: <Timeline --timeline-line-color="tomato">. The --timeline-default-* defaults apply to the whole app: override them in :root or in a theme.

Per-instance variableDefault
--timeline-item-spacing
--timeline-default-item-spacing 22px
--timeline-rail-width
--timeline-default-rail-width 24px
--timeline-content-gap
--timeline-default-content-gap 8px
--timeline-first-line-height
--timeline-default-first-line-height 18px
--timeline-line-width
--timeline-default-line-width 2px
--timeline-group-spacing
--timeline-default-group-spacing 18px
--timeline-width
--timeline-default-width 100%
--timeline-card-padding-y
--timeline-default-card-padding-y 12px
--timeline-line-color
--timeline-default-line-color linear-gradient(var(--global-color-primary), var(--global-color-accent), var(--global-color-border))
--timeline-marker-color
--timeline-default-marker-color var(--global-color-primary)
--timeline-default-success-marker-color var(--global-color-success)
--timeline-default-warning-marker-color var(--global-color-warning)
--timeline-default-error-marker-color var(--global-color-error)
--timeline-default-neutral-marker-color var(--global-color-text-3)
--timeline-current-marker-color
--timeline-default-current-marker-color var(--global-color-accent)
--timeline-marker-size
--timeline-default-marker-size 12px
--timeline-marker-border-width
--timeline-default-marker-border-width 2px
--timeline-marker-background
--timeline-default-marker-background var(--global-color-bg-2)
--timeline-marker-icon-size
--timeline-default-marker-icon-size 14px
--timeline-icon-marker-size
--timeline-default-icon-marker-size 24px
--timeline-done-marker-shadow
--timeline-done-marker-ring-width
--timeline-default-done-marker-ring-width 4px
--timeline-done-marker-glow-size
--timeline-default-done-marker-glow-size 14px
--timeline-card-padding-x
--timeline-default-card-padding-x 14px
--timeline-card-border
--timeline-default-card-border 1px solid var(--global-color-border)
--timeline-card-border-radius
--timeline-default-card-border-radius var(--global-radius-lg)
--timeline-card-background
--timeline-default-card-background var(--global-color-surface)
--timeline-card-shadow
--timeline-default-card-shadow none
--timeline-time-color
--timeline-default-time-color var(--global-color-text-3)
--timeline-time-font-family
--timeline-default-time-font-family var(--global-font-family-mono)
--timeline-time-font-size
--timeline-default-time-font-size 11px
--timeline-title-color
--timeline-default-title-color var(--global-color-text)
--timeline-title-font-size
--timeline-default-title-font-size 14px
--timeline-title-font-weight
--timeline-default-title-font-weight 600
--timeline-description-color
--timeline-default-description-color var(--global-color-text-2)
--timeline-description-font-size
--timeline-default-description-font-size 13px