skip to content
mpkcn

~/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 ↓

  1. // 01

    Install

    One command writes the component, the theme and the fonts.

    npx mpkcn add roadmap
  2. // 02

    Import it

    It's your code now, in components/mpkcn.

    import { Roadmap } from "@/components/mpkcn/roadmap";
  3. // 03

    List your milestones

    A title, a line of text, and anything you like under it.

  4. // 04

    Scroll

    The path draws itself and each stop lights up as the marker reaches it.

  5. // 05

    Ship it

    Square corners, hairlines, amber and blue. Same look as the rest of your site.

step: none

Installation

terminal
npx mpkcn add roadmap
deps:none beyond react· tested with react@19.3.0

Usage

List your milestones in order. Each one has a title, an optional line of text, and anything you want under it:

tsx
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:

tsx
<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.

tsx
<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:

tsx
<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:

tsx
<Roadmap items={steps} layout="left" />

Inside a scroll container

Pass the container as root. This is how the preview above works.

tsx
"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

tsx
<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

PropTypeDefaultDescription
itemsRoadmapItem[]—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.
offsetnumber0.6Where the marker sits, as a fraction of the viewport (or container) height.
rootRefObject<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).
ignoreReducedMotionbooleanfalseAnimate even when the user prefers reduced motion.
ariaLabelstring"Roadmap"Accessible name of the list.
classNamestring—Extra classes for the wrapper.