~/components/roadmap
Roadmap
A roadmap of milestones joined by a path that draws itself as you scroll, with a marker travelling along it and stops that light up when reached.
// scroll down ↓
- // 01
Install
One command writes the component, the theme and the fonts.
npx mpkcn add roadmap
- // 02
Import it
It's your code now, in components/mpkcn.
import { Roadmap } from "@/components/mpkcn/roadmap"; - // 03
List your milestones
A title, a line of text, and anything you like under it.
- // 04
Scroll
The path draws itself and each stop lights up as the marker reaches it.
- // 05
Ship it
Square corners, hairlines, amber and blue. Same look as the rest of your site.
step: none
"use client";
import { useEffect, useRef, useState, type ReactNode, type RefObject } from "react";
export type RoadmapItem = {
/** Milestone title. */
title: ReactNode;
/** One or two lines under the title. */
description?: ReactNode;
/** Small mono label above the title. @default "// 01", "// 02", … */
label?: ReactNode;
/** Status when `mode="static"`: done, current or next. Ignored in scroll mode. */
status?: "done" | "current" | "next";
/** Anything below the description: a code block, a link, a tag list. */
children?: ReactNode;
};
export type RoadmapProps = {
/** Milestones from first to last. */
items: RoadmapItem[];
/** "scroll": the path is drawn as you scroll and each stop lights up when the marker reaches it.
* "static": no scroll tracking; each item's `status` decides how it looks. @default "scroll" */
mode?: "scroll" | "static";
/** "alternate": cards on both sides of the path (single column below the md breakpoint).
* "left": the path on the left, cards on the right, at every width. @default "alternate" */
layout?: "alternate" | "left";
/** "wave": soft curves between stops. "step": right-angle turns, like a git graph. @default "wave" */
curve?: "wave" | "step";
/** Where the marker sits, as a fraction of the viewport (or container) height. @default 0.6 */
offset?: number;
/** Scroll container that holds the roadmap. Omit to track the window. */
root?: RefObject<HTMLElement | null>;
/** Called with the index of the stop the marker reached last (-1 before the first). */
onStepChange?: (index: number) => void;
/** Animate even when the user prefers reduced motion. @default false */
ignoreReducedMotion?: boolean;
/** Accessible name of the list. @default "Roadmap" */
ariaLabel?: string;
className?: string;
};
function cx(...parts: (string | false | undefined)[]): string {
return parts.filter(Boolean).join(" ");
}
type Pt = { x: number; y: number };
function buildPath(pts: Pt[], curve: "wave" | "step", wiggle: number): string {
if (!pts.length) return "";
let d = `M ${pts[0].x} ${pts[0].y - 28} L ${pts[0].x} ${pts[0].y}`;
for (let i = 1; i < pts.length; i++) {
const a = pts[i - 1];
const b = pts[i];
const dy = b.y - a.y;
if (curve === "step") {
const mid = a.y + dy / 2;
d += ` L ${a.x} ${mid} L ${b.x} ${mid} L ${b.x} ${b.y}`;
} else {
const s = i % 2 ? wiggle : -wiggle;
d += ` C ${a.x + s} ${a.y + dy * 0.55}, ${b.x + s} ${b.y - dy * 0.55}, ${b.x} ${b.y}`;
}
}
const last = pts[pts.length - 1];
return `${d} L ${last.x} ${last.y + 28}`;
}
/**
* A roadmap of milestones joined by a path. In scroll mode the path is drawn in amber as you
* scroll, a square marker travels along it, and each stop turns on when the marker reaches it.
* Cards alternate sides on wide screens. Works with the window or any scroll container (`root`).
*/
export function Roadmap({
items,
mode = "scroll",
layout = "alternate",
curve = "wave",
offset = 0.6,
root,
onStepChange,
ignoreReducedMotion = false,
ariaLabel = "Roadmap",
className,
}: RoadmapProps) {
const wrap = useRef<HTMLDivElement>(null);
const base = useRef<SVGPathElement>(null);
const fill = useRef<SVGPathElement>(null);
const marker = useRef<SVGRectElement>(null);
const nodes = useRef<(HTMLSpanElement | null)[]>([]);
const geo = useRef<{ total: number; table: [number, number, number][]; stopLen: number[] }>({ total: 0, table: [], stopLen: [] });
const stepRef = useRef(onStepChange);
const lastRef = useRef<number | null>(null);
const [reached, setReached] = useState(mode === "scroll" ? -1 : items.length);
useEffect(() => {
stepRef.current = onStepChange;
}, [onStepChange]);
const statusOf = (i: number): "done" | "current" | "next" => {
if (mode === "static") return items[i].status ?? "next";
if (i < reached) return "done";
return i === reached ? "current" : "next";
};
// Measure the stops, build the path, and follow the scroll. Rebuilt whenever the size changes.
useEffect(() => {
const el = wrap.current;
if (!el) return;
const reduce = !ignoreReducedMotion && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
// Move the fill and the marker to the scroll position.
const update = () => {
const { total, table, stopLen } = geo.current;
if (!table.length || mode !== "scroll") return;
const scroller = root?.current;
const view = scroller ? scroller.getBoundingClientRect() : { top: 0, height: window.innerHeight };
const target = view.top + view.height * offset - el.getBoundingClientRect().top;
let i = table.findIndex((t) => t[2] >= target);
if (i < 0) i = table.length - 1;
const len = target <= table[0][2] ? 0 : table[i][0];
const p = len === 0 ? table[0] : table[i];
if (fill.current) fill.current.style.strokeDashoffset = `${total - len}`;
marker.current?.setAttribute("x", `${p[1] - 5}`);
marker.current?.setAttribute("y", `${p[2] - 5}`);
let last = -1;
stopLen.forEach((l, k) => {
if (l <= len + 2) last = k;
});
if (lastRef.current !== last) {
lastRef.current = last;
setReached(last);
stepRef.current?.(last);
}
};
const build = () => {
const box = el.getBoundingClientRect();
const pts = nodes.current.slice(0, items.length).map((n) => {
const r = n?.getBoundingClientRect();
return r ? { x: r.left + r.width / 2 - box.left, y: r.top + r.height / 2 - box.top } : { x: 0, y: 0 };
});
const straight = pts.every((p) => Math.abs(p.x - pts[0].x) < 2);
const d = buildPath(pts, curve, straight ? 12 : 0);
base.current?.setAttribute("d", d);
fill.current?.setAttribute("d", d);
const path = fill.current;
if (!path || !d) return;
const total = path.getTotalLength();
const table: [number, number, number][] = [];
for (let l = 0; l <= total; l += 3) {
const p = path.getPointAtLength(l);
table.push([l, p.x, p.y]);
}
const stopLen = pts.map((p) => table.reduce((best, t) => (Math.abs(t[2] - p.y) < Math.abs(best[2] - p.y) ? t : best), table[0])[0]);
geo.current = { total, table, stopLen };
path.style.strokeDasharray = `${total} ${total}`;
path.style.transition = reduce ? "none" : "stroke-dashoffset 120ms linear";
if (mode === "static") {
// fill up to the current (or last done) stop
let upto = -1;
items.forEach((it, k) => {
if (it.status === "done" || it.status === "current") upto = k;
});
const len = upto < 0 ? 0 : stopLen[upto];
path.style.strokeDashoffset = `${total - len}`;
const p = table.find((t) => t[0] >= len) ?? table[table.length - 1];
marker.current?.setAttribute("x", `${p[1] - 5}`);
marker.current?.setAttribute("y", `${p[2] - 5}`);
} else update();
};
let raf = 0;
const onScroll = () => {
if (!raf)
raf = requestAnimationFrame(() => {
raf = 0;
update();
});
};
build();
const ro = new ResizeObserver(build);
ro.observe(el);
document.fonts?.ready.then(build);
const scroller: HTMLElement | Window = root?.current ?? window;
if (mode === "scroll") {
scroller.addEventListener("scroll", onScroll, { passive: true });
window.addEventListener("resize", onScroll);
}
return () => {
ro.disconnect();
cancelAnimationFrame(raf);
scroller.removeEventListener("scroll", onScroll);
window.removeEventListener("resize", onScroll);
};
}, [items, curve, mode, offset, root, ignoreReducedMotion]);
const alt = layout === "alternate";
const motion = ignoreReducedMotion ? "" : "motion-reduce:transition-none";
return (
<div ref={wrap} className={cx("relative", className)}>
<svg aria-hidden="true" className="pointer-events-none absolute inset-0 h-full w-full overflow-visible">
<path ref={base} fill="none" strokeWidth={2} strokeDasharray="2 7" className="stroke-mpk-line" />
<path ref={fill} fill="none" strokeWidth={2.5} strokeLinecap="square" className="stroke-mpk-amber" />
<rect ref={marker} width={10} height={10} className="fill-mpk-amber" />
</svg>
<ol aria-label={ariaLabel} className="relative m-0 grid list-none p-0 py-6">
{items.map((it, i) => {
const s = statusOf(i);
const right = alt && i % 2 === 1;
return (
<li
key={i}
aria-current={s === "current" ? "step" : undefined}
className={cx(
"relative grid items-start gap-x-5 py-3",
alt
? "grid-cols-[40px_minmax(0,1fr)] md:grid-cols-[minmax(0,1fr)_72px_minmax(0,1fr)] md:items-center md:py-0 md:[&+&]:-mt-10 md:min-h-[150px]"
: "grid-cols-[40px_minmax(0,1fr)]",
)}
>
<span
ref={(n) => {
nodes.current[i] = n;
}}
aria-hidden="true"
className={cx(
"relative z-[1] mt-4 grid size-8 place-items-center justify-self-center border font-mpk-mono text-[12px] transition-colors duration-300",
motion,
alt && "md:col-start-2 md:row-start-1 md:mt-0",
alt && (i % 2 ? "md:-left-3" : "md:left-3"),
s === "done" && "border-mpk-amber bg-mpk-amber text-mpk-bg",
s === "current" && "border-mpk-amber bg-mpk-bg text-mpk-amber outline outline-1 outline-offset-4 outline-mpk-amber/40",
s === "next" && "border-mpk-line bg-mpk-bg text-mpk-dim2",
)}
>
{s === "done" ? "✓" : String(i + 1).padStart(2, "0")}
</span>
<div
className={cx(
"grid gap-2 border bg-mpk-bg-soft p-4 transition-[opacity,transform,border-color] duration-500",
motion,
alt && "md:row-start-1 md:w-full md:max-w-[420px]",
alt && (right ? "md:col-start-3 md:justify-self-start" : "md:col-start-1 md:justify-self-end"),
s === "current" ? "border-mpk-amber/60" : "border-mpk-line",
s === "next" && mode === "scroll" ? "translate-y-1 opacity-45" : "translate-y-0 opacity-100",
)}
>
<span className={cx("font-mpk-mono text-[11px]", s === "next" ? "text-mpk-dim2" : "text-mpk-amber")}>
{it.label ?? `// ${String(i + 1).padStart(2, "0")}`}
{s === "current" && <span aria-hidden="true" className={cx("ml-1 inline-block h-[1em] w-[0.5em] translate-y-[2px] bg-mpk-amber", !ignoreReducedMotion && "motion-safe:animate-mpk-blink", ignoreReducedMotion && "animate-mpk-blink")} />}
</span>
<h3 className="m-0 font-mpk-sans text-[17px] font-semibold leading-snug text-mpk-ink">{it.title}</h3>
{it.description && <p className="m-0 text-[14px] leading-relaxed text-mpk-dim">{it.description}</p>}
{it.children}
</div>
</li>
);
})}
</ol>
</div>
);
}Installation
npx mpkcn add roadmap01Add mpkcn-theme.css if you haven't yet (see Installation)
02Copy the source into your components folder
"use client";
import { useEffect, useRef, useState, type ReactNode, type RefObject } from "react";
export type RoadmapItem = {
/** Milestone title. */
title: ReactNode;
/** One or two lines under the title. */
description?: ReactNode;
/** Small mono label above the title. @default "// 01", "// 02", … */
label?: ReactNode;
/** Status when `mode="static"`: done, current or next. Ignored in scroll mode. */
status?: "done" | "current" | "next";
/** Anything below the description: a code block, a link, a tag list. */
children?: ReactNode;
};
export type RoadmapProps = {
/** Milestones from first to last. */
items: RoadmapItem[];
/** "scroll": the path is drawn as you scroll and each stop lights up when the marker reaches it.
* "static": no scroll tracking; each item's `status` decides how it looks. @default "scroll" */
mode?: "scroll" | "static";
/** "alternate": cards on both sides of the path (single column below the md breakpoint).
* "left": the path on the left, cards on the right, at every width. @default "alternate" */
layout?: "alternate" | "left";
/** "wave": soft curves between stops. "step": right-angle turns, like a git graph. @default "wave" */
curve?: "wave" | "step";
/** Where the marker sits, as a fraction of the viewport (or container) height. @default 0.6 */
offset?: number;
/** Scroll container that holds the roadmap. Omit to track the window. */
root?: RefObject<HTMLElement | null>;
/** Called with the index of the stop the marker reached last (-1 before the first). */
onStepChange?: (index: number) => void;
/** Animate even when the user prefers reduced motion. @default false */
ignoreReducedMotion?: boolean;
/** Accessible name of the list. @default "Roadmap" */
ariaLabel?: string;
className?: string;
};
function cx(...parts: (string | false | undefined)[]): string {
return parts.filter(Boolean).join(" ");
}
type Pt = { x: number; y: number };
function buildPath(pts: Pt[], curve: "wave" | "step", wiggle: number): string {
if (!pts.length) return "";
let d = `M ${pts[0].x} ${pts[0].y - 28} L ${pts[0].x} ${pts[0].y}`;
for (let i = 1; i < pts.length; i++) {
const a = pts[i - 1];
const b = pts[i];
const dy = b.y - a.y;
if (curve === "step") {
const mid = a.y + dy / 2;
d += ` L ${a.x} ${mid} L ${b.x} ${mid} L ${b.x} ${b.y}`;
} else {
const s = i % 2 ? wiggle : -wiggle;
d += ` C ${a.x + s} ${a.y + dy * 0.55}, ${b.x + s} ${b.y - dy * 0.55}, ${b.x} ${b.y}`;
}
}
const last = pts[pts.length - 1];
return `${d} L ${last.x} ${last.y + 28}`;
}
/**
* A roadmap of milestones joined by a path. In scroll mode the path is drawn in amber as you
* scroll, a square marker travels along it, and each stop turns on when the marker reaches it.
* Cards alternate sides on wide screens. Works with the window or any scroll container (`root`).
*/
export function Roadmap({
items,
mode = "scroll",
layout = "alternate",
curve = "wave",
offset = 0.6,
root,
onStepChange,
ignoreReducedMotion = false,
ariaLabel = "Roadmap",
className,
}: RoadmapProps) {
const wrap = useRef<HTMLDivElement>(null);
const base = useRef<SVGPathElement>(null);
const fill = useRef<SVGPathElement>(null);
const marker = useRef<SVGRectElement>(null);
const nodes = useRef<(HTMLSpanElement | null)[]>([]);
const geo = useRef<{ total: number; table: [number, number, number][]; stopLen: number[] }>({ total: 0, table: [], stopLen: [] });
const stepRef = useRef(onStepChange);
const lastRef = useRef<number | null>(null);
const [reached, setReached] = useState(mode === "scroll" ? -1 : items.length);
useEffect(() => {
stepRef.current = onStepChange;
}, [onStepChange]);
const statusOf = (i: number): "done" | "current" | "next" => {
if (mode === "static") return items[i].status ?? "next";
if (i < reached) return "done";
return i === reached ? "current" : "next";
};
// Measure the stops, build the path, and follow the scroll. Rebuilt whenever the size changes.
useEffect(() => {
const el = wrap.current;
if (!el) return;
const reduce = !ignoreReducedMotion && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
// Move the fill and the marker to the scroll position.
const update = () => {
const { total, table, stopLen } = geo.current;
if (!table.length || mode !== "scroll") return;
const scroller = root?.current;
const view = scroller ? scroller.getBoundingClientRect() : { top: 0, height: window.innerHeight };
const target = view.top + view.height * offset - el.getBoundingClientRect().top;
let i = table.findIndex((t) => t[2] >= target);
if (i < 0) i = table.length - 1;
const len = target <= table[0][2] ? 0 : table[i][0];
const p = len === 0 ? table[0] : table[i];
if (fill.current) fill.current.style.strokeDashoffset = `${total - len}`;
marker.current?.setAttribute("x", `${p[1] - 5}`);
marker.current?.setAttribute("y", `${p[2] - 5}`);
let last = -1;
stopLen.forEach((l, k) => {
if (l <= len + 2) last = k;
});
if (lastRef.current !== last) {
lastRef.current = last;
setReached(last);
stepRef.current?.(last);
}
};
const build = () => {
const box = el.getBoundingClientRect();
const pts = nodes.current.slice(0, items.length).map((n) => {
const r = n?.getBoundingClientRect();
return r ? { x: r.left + r.width / 2 - box.left, y: r.top + r.height / 2 - box.top } : { x: 0, y: 0 };
});
const straight = pts.every((p) => Math.abs(p.x - pts[0].x) < 2);
const d = buildPath(pts, curve, straight ? 12 : 0);
base.current?.setAttribute("d", d);
fill.current?.setAttribute("d", d);
const path = fill.current;
if (!path || !d) return;
const total = path.getTotalLength();
const table: [number, number, number][] = [];
for (let l = 0; l <= total; l += 3) {
const p = path.getPointAtLength(l);
table.push([l, p.x, p.y]);
}
const stopLen = pts.map((p) => table.reduce((best, t) => (Math.abs(t[2] - p.y) < Math.abs(best[2] - p.y) ? t : best), table[0])[0]);
geo.current = { total, table, stopLen };
path.style.strokeDasharray = `${total} ${total}`;
path.style.transition = reduce ? "none" : "stroke-dashoffset 120ms linear";
if (mode === "static") {
// fill up to the current (or last done) stop
let upto = -1;
items.forEach((it, k) => {
if (it.status === "done" || it.status === "current") upto = k;
});
const len = upto < 0 ? 0 : stopLen[upto];
path.style.strokeDashoffset = `${total - len}`;
const p = table.find((t) => t[0] >= len) ?? table[table.length - 1];
marker.current?.setAttribute("x", `${p[1] - 5}`);
marker.current?.setAttribute("y", `${p[2] - 5}`);
} else update();
};
let raf = 0;
const onScroll = () => {
if (!raf)
raf = requestAnimationFrame(() => {
raf = 0;
update();
});
};
build();
const ro = new ResizeObserver(build);
ro.observe(el);
document.fonts?.ready.then(build);
const scroller: HTMLElement | Window = root?.current ?? window;
if (mode === "scroll") {
scroller.addEventListener("scroll", onScroll, { passive: true });
window.addEventListener("resize", onScroll);
}
return () => {
ro.disconnect();
cancelAnimationFrame(raf);
scroller.removeEventListener("scroll", onScroll);
window.removeEventListener("resize", onScroll);
};
}, [items, curve, mode, offset, root, ignoreReducedMotion]);
const alt = layout === "alternate";
const motion = ignoreReducedMotion ? "" : "motion-reduce:transition-none";
return (
<div ref={wrap} className={cx("relative", className)}>
<svg aria-hidden="true" className="pointer-events-none absolute inset-0 h-full w-full overflow-visible">
<path ref={base} fill="none" strokeWidth={2} strokeDasharray="2 7" className="stroke-mpk-line" />
<path ref={fill} fill="none" strokeWidth={2.5} strokeLinecap="square" className="stroke-mpk-amber" />
<rect ref={marker} width={10} height={10} className="fill-mpk-amber" />
</svg>
<ol aria-label={ariaLabel} className="relative m-0 grid list-none p-0 py-6">
{items.map((it, i) => {
const s = statusOf(i);
const right = alt && i % 2 === 1;
return (
<li
key={i}
aria-current={s === "current" ? "step" : undefined}
className={cx(
"relative grid items-start gap-x-5 py-3",
alt
? "grid-cols-[40px_minmax(0,1fr)] md:grid-cols-[minmax(0,1fr)_72px_minmax(0,1fr)] md:items-center md:py-0 md:[&+&]:-mt-10 md:min-h-[150px]"
: "grid-cols-[40px_minmax(0,1fr)]",
)}
>
<span
ref={(n) => {
nodes.current[i] = n;
}}
aria-hidden="true"
className={cx(
"relative z-[1] mt-4 grid size-8 place-items-center justify-self-center border font-mpk-mono text-[12px] transition-colors duration-300",
motion,
alt && "md:col-start-2 md:row-start-1 md:mt-0",
alt && (i % 2 ? "md:-left-3" : "md:left-3"),
s === "done" && "border-mpk-amber bg-mpk-amber text-mpk-bg",
s === "current" && "border-mpk-amber bg-mpk-bg text-mpk-amber outline outline-1 outline-offset-4 outline-mpk-amber/40",
s === "next" && "border-mpk-line bg-mpk-bg text-mpk-dim2",
)}
>
{s === "done" ? "✓" : String(i + 1).padStart(2, "0")}
</span>
<div
className={cx(
"grid gap-2 border bg-mpk-bg-soft p-4 transition-[opacity,transform,border-color] duration-500",
motion,
alt && "md:row-start-1 md:w-full md:max-w-[420px]",
alt && (right ? "md:col-start-3 md:justify-self-start" : "md:col-start-1 md:justify-self-end"),
s === "current" ? "border-mpk-amber/60" : "border-mpk-line",
s === "next" && mode === "scroll" ? "translate-y-1 opacity-45" : "translate-y-0 opacity-100",
)}
>
<span className={cx("font-mpk-mono text-[11px]", s === "next" ? "text-mpk-dim2" : "text-mpk-amber")}>
{it.label ?? `// ${String(i + 1).padStart(2, "0")}`}
{s === "current" && <span aria-hidden="true" className={cx("ml-1 inline-block h-[1em] w-[0.5em] translate-y-[2px] bg-mpk-amber", !ignoreReducedMotion && "motion-safe:animate-mpk-blink", ignoreReducedMotion && "animate-mpk-blink")} />}
</span>
<h3 className="m-0 font-mpk-sans text-[17px] font-semibold leading-snug text-mpk-ink">{it.title}</h3>
{it.description && <p className="m-0 text-[14px] leading-relaxed text-mpk-dim">{it.description}</p>}
{it.children}
</div>
</li>
);
})}
</ol>
</div>
);
}03Update the import paths to match your project
Usage
List your milestones in order. Each one has a title, an optional line of text, and anything you want under it:
import { Roadmap } from "@/components/mpkcn/roadmap";
const steps = [
{ title: "Install", description: "One command, no manual setup." },
{ title: "Scan", description: "Reads your files and tests as plain text." },
{ title: "Ask", description: "Eight questions about your own code." },
{ title: "Check", description: "Invented citations are dropped." },
];
export function HowItWorks() {
return <Roadmap items={steps} />;
}As you scroll, the path is drawn in amber and a square marker travels along it. A stop turns on when the marker reaches it: passed stops show a filled square with a check, the current one gets an outline and a blinking cursor, and the ones ahead stay dim. The marker sits at 60% of the viewport height; change it with offset.
On wide screens the cards alternate sides of the path. Below the md breakpoint they stack on the right of it.
Examples
Code under a milestone
Anything you pass as children goes under the description:
<Roadmap
items={[
{
title: "Install",
description: "Writes the component, the theme and the fonts.",
children: (
<pre className="border border-mpk-line bg-mpk-bg px-3 py-2 font-mpk-mono text-[12px]">npx mpkcn add roadmap</pre>
),
},
// …
]}
/>A product roadmap
Use mode="static" and set each item's status. Nothing follows the scroll: the path is filled up to the current stop.
<Roadmap
mode="static"
items={[
{ title: "v0.1: first release", status: "done" },
{ title: "v0.2: MCP server", status: "done" },
{ title: "v0.3: predict questions", status: "current", label: "// now" },
{ title: "v0.4: Go support", status: "next", label: "// next" },
]}
/>Right-angle path
curve="step" turns the path into straight lines and right angles, like a git graph:
<Roadmap items={steps} curve="step" />Path on the left
layout="left" keeps the path on the left and the cards on the right at every width:
<Roadmap items={steps} layout="left" />Inside a scroll container
Pass the container as root. This is how the preview above works.
"use client";
import { useRef } from "react";
import { Roadmap } from "@/components/mpkcn/roadmap";
export function Panel() {
const box = useRef<HTMLDivElement>(null);
return (
<div ref={box} className="h-96 overflow-y-auto">
<Roadmap items={steps} root={box} />
</div>
);
}React to the current step
<Roadmap items={steps} onStepChange={(i) => setStep(i)} />i is the index of the stop the marker reached last, or -1 before the first one.
Accessibility
The milestones are an ordered list, and the current one has aria-current="step". The path, the marker and the numbers are decorative and hidden from screen readers. With reduced motion the path still follows the scroll, but nothing eases or blinks; pass ignoreReducedMotion to animate anyway.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | RoadmapItem[] | — | Milestones from first to last: { title, description?, label?, status?, children? }. |
| mode | "scroll" | "static" | "scroll" | scroll: drawn as you scroll. static: each item's status decides how it looks. |
| layout | "alternate" | "left" | "alternate" | Cards on both sides of the path on wide screens, or always on the right. |
| curve | "wave" | "step" | "wave" | Soft curves between stops, or right-angle turns. |
| offset | number | 0.6 | Where the marker sits, as a fraction of the viewport (or container) height. |
| root | RefObject<HTMLElement | null> | — | Scroll container that holds the roadmap. Omit to track the window. |
| onStepChange | (index: number) => void | — | Called with the index of the stop reached last (-1 before the first). |
| ignoreReducedMotion | boolean | false | Animate even when the user prefers reduced motion. |
| ariaLabel | string | "Roadmap" | Accessible name of the list. |
| className | string | — | Extra classes for the wrapper. |