Loading component…
Loading component…
One line per commit on a blue trail – message, a colored tag for the kind of change and how long ago, open for who wrote it, and merges that fold the commits they brought in
To reuse this local React demo, copy all files from the Code tab into the same folder, then import CommitTrail from ./commit-trail.
import { CommitTrail, type TrailCommit } from "@/components/ui/commit-trail";
const claude = { name: "Claude", agent: true };
const commits: TrailCommit[] = [
{ id: "a41c7e2b", message: "Release 3.1", author: { name: "Mara Lind" }, time: Date.now() - 26 * 60_000, tag: "v3.1" },
{
id: "9be20f11",
message: "Merge `invoice-pdf` into `main`",
author: { name: "Tomás Reyes" },
time: "2026-11-13T09:10:00Z",
commits: [
{ id: "d7a90c4e", message: "Render line items as a PDF table", author: claude, added: 286, removed: 22 },
{ id: "53f1b8a0", message: "Embed fonts in invoice exports", author: { name: "Tomás Reyes" }, coAuthor: claude },
],
},
{ id: "e02c6d97", message: "Fix rounding on prorated plans", author: { name: "Kai Brandt" }, kind: "fix", files: 2, added: 18, removed: 9 },
];
export function History() {
return <CommitTrail commits={commits} branches={["main", "invoice-pdf"]} hasMore />;
}| Name | Type | Default | Description |
|---|---|---|---|
| commits | TrailCommit[] | Newest first – { id, message, author, coAuthor?, time?, tag?, files?, added?, removed?, body?, commits?, pending? } | |
| author / coAuthor | { name; agent?; color?; avatar? } | Who wrote it – shown when the commit is open, "Ines Okoro with Claude": an agent with its pixel mark before its name (in its color, blue when there is one), a person with avatar – your own icon or symbol – when you give one. The rows themselves stay quiet; screen readers hear the names on every row | |
| time | number \| Date \| string | When – ms, a Date or ISO text, shown on the right as "now", 4m, 2h, 3d, 1w, 5mo, 2y and in full when open; other text shows as it is | |
| commit.commits | TrailCommit[] | On a merge: the commits of the branch it brought in – the row folds them, with a chevron on hover; open, they bend off the trail as small dots with their kind and when on the right | |
| message | string | One line – put branch and file names in backticks ("Merge invoice-pdf into main") and they show as light chips: a file (it has an extension) with the file icon, anything else with the branch icon | |
| refs | Record<string, string> | More about the names in messages – rest the pointer on one for 0.4s and a compact dark tooltip shows above it: its icon, its name and this text (File or Branch without one) ("src/webhooks/queue.ts", "3 commits, merged by Tomás Reyes") | |
| kind | string | What kind of change – a colored tag on the right, before the time: feat (Feature, green), fix (orange), refactor (violet), perf (teal), docs (blue), test (Tests, amber), chore (gray), release (pink), merge (indigo), or a kind of your own | |
| kinds | Record<string, { label?; color? }> | Rename a kind or add your own with its color – { feat: { label: "New" }, ui: { label: "UI", color: "#ee3e9e" } }; a kind without a color is gray | |
| tag | string | A release or tag – a small quiet chip after the message | |
| files / added / removed / body | number / string | What it changed and the rest of the message – shown when the commit is open, under who and when | |
| pending | boolean | Still being written: its marker's arc turns as in Agent Trail, "Committing" shimmers on the right; drop it and the commit lands – the check draws itself and the line fills | |
| branches / branch / defaultBranch / onBranchChange | string[] / string / string / (b) => void | The branch, as the header's title – with two or more it opens a menu to switch. Swap commits on change | |
| open / defaultOpen / onOpenChange | string \| null | Which commit is open – one at a time, a branch's commits too; the others step back | |
| expanded / defaultExpanded / onExpandedChange | string[] | Which merges show their branch's commits – folded by default | |
| hasMore | boolean | Older commits exist – the trail runs on past the last one and fades | |
| maxHeight | number | The list scrolls past this height (px) | |
| locale | string | The locale dates are written in – "en-US" by default; set it together with labels | |
| labels | Partial<CommitTrailLabels> | Every word: title, empty, committing, untitled, copy, copied, with, now, switchBranch, file, branch, commits(n), files(n), landed(who, message) | |
| className | string | Extra class on the root – set the color variables on it |
One line per commit – 32px, a branch's commit 24px, 40px and 28px on touch screens, as in Agent Trail – so a landing commit or a changing time never moves another row
A name in a message gets a dark tooltip after a short rest on it – in the top layer, so it is never cut off; touch screens skip it
Long messages are cut inside a name's chip ("proration.t…") instead of dropping it; tags and branches end in … with the full text on hover; every time sits in one column as wide as "00m", so the tags line up
No commits: the header stays and a quiet "No commits yet" takes the list's place
Right-to-left: the trail moves to the right edge and the branch line bends the other way; messages, times and tags read in their own direction while their gaps follow the list
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"