Changelog
Releases on a scrubber. Drag through the versions and one live sample of your product morphs into how it looked at each one, with that release's notes beside it.
npx shadcn@latest add https://captain-ui.vercel.app/r/changelog.jsonPlan first
0.5, 14 Nov 2026
- Ask for a plan, approve it, then let the agent build.
- Send moved into the composer as one ink key.
"use client";
// Captain UI · Changelog, MIT. Scrub through the releases and one live sample of your UI morphs into how it looked at each version.
import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
import { useId, useRef, useState, type ReactNode } from "react";
import { EASE, cx } from "@/registry/captain/ui/captain";
import { Slider } from "@/registry/captain/ui/slider";
export type Release = { version: string; date: string; title: string; changes: string[] };
type ChangelogProps = {
/** Oldest first. */
releases: Release[];
/** Your UI as it looked at release `index`. Give its parts `layout` and stable keys so they morph between versions. */
renderSample: (index: number) => ReactNode;
/** Defaults to the latest release. */
defaultIndex?: number;
className?: string;
};
export function Changelog({ releases, renderSample, defaultIndex, className }: ChangelogProps) {
const last = releases.length - 1;
const [index, setIndex] = useState(defaultIndex ?? last);
const prev = useRef(index);
const dir = Math.sign(index - prev.current) || 1;
prev.current = index;
const reduce = useReducedMotion();
const id = useId();
const r = releases[index];
return (
<section className={cx("grid gap-8 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)] md:items-start", className)} aria-labelledby={`${id}-v`}>
<div className="well relative flex min-h-[300px] items-center justify-center overflow-hidden rounded-shell p-4 sm:p-8" aria-hidden>
<LayoutGroup id={id}>{renderSample(index)}</LayoutGroup>
</div>
<div className="min-w-0">
<Slider
aria-label="Version"
value={[index]}
onValueChange={(v) => setIndex(v[0] ?? last)}
min={0}
max={Math.max(1, last)}
step={1}
ticks
format={(v) => releases[v]?.version ?? ""}
/>
<div className="relative mx-[11px] -mt-1 h-8">
{releases.map((rel, i) => (
<button
key={rel.version}
type="button"
tabIndex={-1}
onClick={() => setIndex(i)}
className={cx(
"tnum absolute top-0 h-8 -translate-x-1/2 rounded-[6px] px-1.5 text-[12px] transition-colors duration-150 hover:text-ink",
i === index ? "font-medium text-ink" : "text-ink-3",
)}
style={{ left: `${(i / Math.max(1, last)) * 100}%` }}
>
{rel.version}
</button>
))}
</div>
<div className="relative mt-5 overflow-hidden">
<AnimatePresence initial={false} mode="popLayout" custom={dir}>
{r ? (
<motion.article
key={r.version}
custom={dir}
variants={{
enter: (d: number) => ({ opacity: 0, y: reduce ? 0 : d * 14 }),
center: { opacity: 1, y: 0 },
exit: (d: number) => ({ opacity: 0, y: reduce ? 0 : d * -14 }),
}}
initial="enter"
animate="center"
exit="exit"
transition={{ duration: 0.22, ease: EASE }}
aria-live="polite"
>
<h3 id={`${id}-v`} className="flex items-baseline gap-3">
<span className="text-[17px] font-medium text-ink">{r.title}</span>
</h3>
<p className="tnum mt-1 text-[12.5px] text-ink-3">
{r.version}, {r.date}
</p>
<ul className="mt-4 flex flex-col gap-2.5 text-[13.5px] leading-relaxed text-ink-2">
{r.changes.map((c) => (
<li key={c}>{c}</li>
))}
</ul>
</motion.article>
) : null}
</AnimatePresence>
</div>
</div>
</section>
);
}Usage
import { Changelog } from "@/components/ui/changelog"
<Changelog releases={releases} renderSample={(i) => <Composer version={i} />} />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| releases | { version; date; title; changes: string[] }[] | Oldest first. | |
| renderSample | (index: number) => ReactNode | Your UI at that release. Give its parts layout and stable keys and they morph between versions. | |
| defaultIndex | number | the latest | The release shown first. |
Keyboard
- ← →
- Previous / next release
- Home / End
- First / latest release
Accessibility
- The scrubber is the Captain slider, named Version, with the version as its spoken value.
- The notes are a polite live region, so moving the scrubber reads the release title and changes.
- The sample is decorative and hidden from screen readers; the notes carry the content.