# Timeline

> Vertical timeline drawn as a light rail: a glowing head travels a hairline track as you scroll, leaving a soft trail and igniting each entry's dot as it arrives.

- Package: `fancy-ui-svelte` (Svelte 5 + Tailwind CSS v4)
- Category: Navigation
- Tags: timeline, scroll, navigation, progress, vertical
- Types: `TimelineProps`, `TimelineItem`
- Docs: https://fancy-ui.rama.app/docs/components/timeline
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/src/lib/fancy-ui/timeline

## Import

```svelte
<script lang="ts">
  import { Timeline } from 'fancy-ui-svelte';
</script>
```

Setup (once per project): `npm install fancy-ui-svelte`, then add `@import "fancy-ui-svelte/tailwind.css";` after `@import "tailwindcss";` in your main CSS file. Full guide: https://fancy-ui.rama.app/llms.txt

React: `import { Timeline } from 'fancy-ui-react';` (`class` becomes `className`, snippets become `ReactNode`, DOM callbacks are camel-cased; exact names on https://fancy-ui.rama.app/docs/components/react/timeline.md).

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `TimelineItem[]` | `[]` | Timeline entries with id and label |
| `title` | `string` | — | Heading text |
| `description` | `string` | — | Subheading text |
| `accent` | `string` | `undefined (follows --primary, falls back to oklch(0.7 0.13 285))` | Colour of the travelling head, its trail and the lit dots. Any CSS colour; also settable via the --timeline-accent CSS variable. |

## Snippets

| Snippet | Description |
| --- | --- |
| `content` | Content snippet called for each timeline item, receives the item as argument |

## Examples

### Basic Usage

A four-release changelog in nested-frame cards; the head rests on the first entry until you scroll.

```svelte
<script lang="ts">
	import { Timeline } from "fancy-ui-svelte";

	const items = [
		{ id: "v4-2", label: "v4.2" },
		{ id: "v4-1", label: "v4.1" },
		{ id: "v4-0", label: "v4.0" },
		{ id: "v3-8", label: "v3.8" },
	];

	const entries: Record<
		string,
		{ date: string; tag: string; title: string; body: string; changes: number }
	> = {
		"v4-2": {
			date: "Sep 12, 2026",
			tag: "Feature",
			changes: 14,
			title: "Streaming exports",
			body: "Large reports now stream to disk while they render, so a 2 GB export starts downloading in under a second.",
		},
		"v4-1": {
			date: "Aug 03, 2026",
			tag: "Performance",
			changes: 9,
			title: "Faster cold starts",
			body: "The worker pool warms in the background, cutting first-request latency by 38% across every region.",
		},
		"v4-0": {
			date: "Jun 18, 2026",
			tag: "Breaking",
			changes: 23,
			title: "Scoped permissions",
			body: "Roles give way to scoped policies. A migration assistant rewrites existing roles on the first sign-in.",
		},
		"v3-8": {
			date: "Apr 27, 2026",
			tag: "Fix",
			changes: 6,
			title: "Calmer notifications",
			body: "Digest mode batches low-priority alerts into one daily summary instead of a steady stream of pings.",
		},
	};
</script>

<Timeline {items} title="Changelog" description="Every release, in the order it shipped.">
	{#snippet content(item)}
		{@const entry = entries[item.id]}
		<article class="max-w-md">
			<p class="text-foreground mb-3 text-lg font-semibold tracking-tight md:hidden">
				{item.label}
			</p>
			<!-- Outer frame -->
			<div
				class="rounded-2xl border border-black/[0.08] bg-black/[0.025] p-1.5 dark:border-white/[0.08] dark:bg-[#0b0b0c]"
			>
				<!-- Inner card -->
				<div
					class="rounded-[11px] border border-black/[0.08] bg-white p-5 shadow-[0_1px_2px_rgba(0,0,0,0.04)] dark:border-white/[0.08] dark:bg-[#141416] dark:shadow-none"
				>
					<div class="mb-3 flex items-center justify-between gap-3">
						<span
							class="text-muted-foreground font-mono text-[11px] tracking-wide whitespace-nowrap"
						>
							{entry.date}
						</span>
						<span
							class="text-muted-foreground rounded-full border border-black/[0.08] px-2 py-0.5 text-[11px] leading-4 dark:border-white/[0.1]"
						>
							{entry.tag}
						</span>
					</div>
					<h4 class="text-foreground text-[15px] font-medium tracking-tight">{entry.title}</h4>
					<p class="text-muted-foreground mt-1.5 text-sm leading-relaxed">{entry.body}</p>
				</div>
				<div
					class="text-muted-foreground/80 flex items-center justify-between px-3.5 pt-2 pb-1 font-mono text-[10.5px] tracking-wide"
				>
					<span>{item.label}.0</span>
					<span>{entry.changes} changes</span>
				</div>
			</div>
		</article>
	{/snippet}
</Timeline>
```

### Custom Accent

A roadmap with a teal accent passed through the accent prop.

```svelte
<script lang="ts">
	import { Timeline } from "fancy-ui-svelte";

	const items = [
		{ id: "q1", label: "Q1" },
		{ id: "q2", label: "Q2" },
		{ id: "q3", label: "Q3" },
	];

	const entries: Record<string, { status: string; title: string; body: string }> = {
		q1: {
			status: "Shipped",
			title: "Offline drafts",
			body: "Everything you type is kept on the device first and synced the moment a connection returns.",
		},
		q2: {
			status: "In progress",
			title: "Shared workspaces",
			body: "Invite a team, split work into spaces and keep a single audit trail for every change.",
		},
		q3: {
			status: "Planned",
			title: "Public API",
			body: "Read and write access with scoped tokens, webhooks for every event and typed client libraries.",
		},
	};
</script>

<Timeline
	{items}
	accent="oklch(0.76 0.13 190)"
	title="Roadmap"
	description="Where the product is heading."
>
	{#snippet content(item)}
		{@const entry = entries[item.id]}
		<article class="max-w-md">
			<p class="text-foreground mb-3 text-lg font-semibold tracking-tight md:hidden">
				{item.label}
			</p>
			<div
				class="rounded-2xl border border-black/[0.08] bg-black/[0.025] p-1.5 dark:border-white/[0.08] dark:bg-[#0b0b0c]"
			>
				<div
					class="rounded-[11px] border border-black/[0.08] bg-white p-5 dark:border-white/[0.08] dark:bg-[#141416]"
				>
					<span
						class="text-muted-foreground mb-3 inline-flex items-center gap-1.5 font-mono text-[11px] tracking-wide"
					>
						<span class="size-1.5 rounded-full bg-[oklch(0.76_0.13_190)]" aria-hidden="true"></span>
						{entry.status}
					</span>
					<h4 class="text-foreground text-[15px] font-medium tracking-tight">{entry.title}</h4>
					<p class="text-muted-foreground mt-1.5 text-sm leading-relaxed">{entry.body}</p>
				</div>
			</div>
		</article>
	{/snippet}
</Timeline>
```
