Commit History Timeline
Commit history list grouped by day under a branch tag: small-dot timeline rows with a truncated message, author and time, a quiet Verified outline badge and the short sha as a monospace tag on the right.
import { Eyebrow } from "@/components/eyebrow/eyebrow"
import {
Timeline,
TimelineContent,
TimelineDescription,
TimelineIndicator,
TimelineItem,
TimelineTitle,
} from "@/components/timeline/timeline"
import { Badge } from "@/components/ui/badge"
// The copy: change text here, not in the markup.
const COPY = {
title: "Commits",
branch: "main",
verified: "Verified",
} as const
const DAYS = [
{
date: "25 October 2026",
commits: [
{
sha: "6821a5c",
message:
"Retire blocks/compositions: its three scenes move to components/scene",
author: "Pamela Melroy",
time: "21:40",
verified: true,
},
{
sha: "9075cbc",
message: "Cut quiz and survey from Stepper",
author: "Pamela Melroy",
time: "21:12",
verified: true,
},
{
sha: "345c57b",
message: "Timeline and Stepper families: 27 free blocks",
author: "Pamela Melroy",
time: "20:58",
verified: true,
},
{
sha: "5578512",
message: "shadcn CLI 4.22.1 to match Lab",
author: "Alexei Leonov",
time: "13:35",
},
],
},
{
date: "24 October 2026",
commits: [
{
sha: "e43ddee",
message: "Registry meta, payloads, catalog and previews",
author: "Pamela Melroy",
time: "18:02",
verified: true,
},
{
sha: "6e51b19",
message: "Temp: chart colors from the Warmth orange",
author: "Megan McArthur",
time: "16:48",
},
],
},
] as const
// Grouped by day, newest first; the sha is a mono tag on the right, the
// author and time one muted line. Verified is a quiet outline badge.
export default function CommitHistoryTimeline01() {
return (
<section className="mx-auto w-full max-w-2xl">
<header className="mb-6 flex items-baseline gap-3">
<h2 className="text-base font-semibold">{COPY.title}</h2>
<code className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs">
{COPY.branch}
</code>
</header>
<div className="grid gap-6">
{DAYS.map((d) => (
<div key={d.date}>
<Eyebrow className="mb-3" render={<h3 />}>
{d.date}
</Eyebrow>
<Timeline className="[--timeline-dot:0.5rem] [--timeline-lh:1.25rem] [--timeline-nudge:0px]">
{d.commits.map((c) => (
<TimelineItem key={c.sha}>
<TimelineIndicator variant="solid" />
<TimelineContent className="grid grid-cols-[1fr_auto] gap-x-4 pb-4">
<div className="min-w-0">
<TimelineTitle className="truncate text-sm/5">
{c.message}
</TimelineTitle>
<TimelineDescription className="mt-0.5 flex gap-x-2 text-xs">
<span>{c.author}</span>
<span aria-hidden>·</span>
<span className="tabular-nums">{c.time}</span>
{"verified" in c && c.verified && (
<Badge
variant="outline"
className="h-4 px-1.5 text-[10px]"
>
{COPY.verified}
</Badge>
)}
</TimelineDescription>
</div>
<code className="self-start rounded bg-muted px-1.5 py-0.5 font-mono text-xs">
{c.sha}
</code>
</TimelineContent>
</TimelineItem>
))}
</Timeline>
</div>
))}
</div>
</section>
)
}
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
const eyebrowVariants = cva("text-eyebrow", {
variants: {
/**
* `default` is a 14px/20px label. `icon` adds a row with a 16px icon
* and a 12px gap; put the icon first and give it `aria-hidden`.
* `mono` is a 12px/20px label in the mono face, in sentence case like
* the others: the kit sets no label in capitals.
*/
variant: {
default: "text-sm/5 font-medium text-eyebrow",
icon: "flex items-center gap-3 text-sm/5 font-medium [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
mono: "font-mono text-xs/5 font-medium",
},
},
defaultVariants: { variant: "default" },
})
/**
* A short label above a heading, rendered as a `<p>` at weight 500.
* The default is 14px/20px in the kit's eyebrow color. The surrounding
* layout controls the space to the heading. Use `className` to customize
* the typography or color, and `render` to change the element: a `p` is
* right when the label stands alone as a line of text; pass
* `render={<span />}` or `render={<div />}` when it sits inside a heading,
* link, button or other inline text, where a `p` is not valid HTML.
*/
function Eyebrow({
className,
variant = "default",
render,
...props
}: useRender.ComponentProps<"p"> & VariantProps<typeof eyebrowVariants>) {
return useRender({
defaultTagName: "p",
render,
state: { slot: "eyebrow", variant },
props: mergeProps<"p">(
{ className: cn(eyebrowVariants({ variant }), className) },
props
),
})
}
export { Eyebrow, eyebrowVariants }
import type { ComponentProps } from "react"
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cn } from "cn"
/**
* A vertical timeline, as an ordered list. Holds `TimelineItem` entries,
* each with a mark and a line down to the next.
*
* Three CSS variables, set on it through `className` or `style`, tune the
* marks. `--timeline-lh` is the line height of the first line in
* `TimelineContent`, so the mark lines up with it: the default 1rem suits a
* leading `TimelineLabel`; set 1.5rem when a title or body text comes first.
* `--timeline-dot` is the mark's diameter (1rem). `--timeline-nudge` (1px)
* lowers the mark slightly, because a mark centered on a line of text looks
* high.
*/
function Timeline({ className, ...props }: ComponentProps<"ol">) {
return (
<ol
role="list"
data-slot="timeline"
className={cn(
"relative [--timeline-dot:1rem] [--timeline-lh:1rem] [--timeline-nudge:1px]",
"[--timeline-shift:calc((var(--timeline-lh)-var(--timeline-dot))/2+var(--timeline-nudge))]",
className
)}
{...props}
/>
)
}
/**
* One entry, an `li` by default. Put a `TimelineIndicator` and a
* `TimelineContent` inside it. It draws the line from under its mark to the
* next entry's mark; the last entry has none. A `Timeline` nested inside
* `TimelineContent` keeps its own lines.
*/
function TimelineItem({
className,
children,
render,
...props
}: useRender.ComponentProps<"li">) {
return useRender({
defaultTagName: "li",
render,
state: { slot: "timeline-item" },
props: mergeProps<"li">(
{
className: cn(
"group/timeline-item relative flex items-start gap-3",
className
),
children: (
<>
<div
aria-hidden
data-slot="timeline-line"
className={cn(
// Runs from under this mark to the top of the next, never through it. The
// last-item check looks at the direct parent only, so a Timeline nested in
// TimelineContent keeps its own rails.
"pointer-events-none absolute top-[calc(var(--timeline-shift)+var(--timeline-dot))]",
"left-[calc(var(--timeline-dot)/2)] w-px -translate-x-1/2",
"h-[calc(100%-var(--timeline-dot))]",
// A 1px rail can't get thinner, so it is lighter than the type.
"bg-muted-foreground/45 [[data-slot=timeline-item]:last-child>&]:hidden"
)}
/>
{children}
</>
),
},
props
),
})
}
const indicatorVariants = {
default: { ring: "", dot: "bg-foreground" },
muted: { ring: "border-border", dot: "bg-muted-foreground/60" },
plain: { ring: "border-0", dot: "bg-muted-foreground/60" },
faint: { ring: "border-0", dot: "bg-border" },
line: { ring: "border-border", dot: "bg-border" },
empty: { ring: "border-border bg-transparent", dot: "hidden" },
solid: { ring: "border-0 bg-muted-foreground/60", dot: "hidden" },
inverted: { ring: "border-0 bg-foreground", dot: "bg-background" },
primary: { ring: "border-primary", dot: "bg-primary" },
}
/**
* The mark beside an entry. With no children it shows a small dot in a ring.
* Pass an element, such as an icon, to show your own mark instead; the ring
* and fill are then removed. Bare text and `false` are not supported.
*
* `variant` picks how the default mark looks, so a finished, current or
* upcoming entry can read differently without overriding the dot:
* `default` is a foreground ring and dot (the current entry); `muted` a
* soft ring with a muted dot; `plain` a muted dot with no ring; `faint` a
* pale dot with no ring; `line` a soft ring with a pale dot; `empty` an
* empty soft ring (upcoming); `solid` a filled muted disc; `inverted` a
* foreground disc with a background-colored dot; `primary` a primary ring
* and dot. It has no effect on a custom child.
*/
function TimelineIndicator({
className,
children,
variant = "default",
...props
}: ComponentProps<"div"> & {
/** Which look the default mark takes. See the part's description. */
variant?: keyof typeof indicatorVariants
}) {
const look = indicatorVariants[variant]
return (
<div
data-slot="timeline-indicator"
data-variant={variant}
className={cn(
"relative z-10 mt-(--timeline-shift) flex shrink-0",
"size-(--timeline-dot) items-center justify-center rounded-full",
// No children: the default dot in its ring. An element child: your mark,
// no ring. false, [] and bare text are not supported forms.
"border-[1.5px] border-foreground bg-background",
"has-[*:not([data-slot=timeline-dot])]:border-0",
"has-[*:not([data-slot=timeline-dot])]:bg-transparent",
look.ring,
className
)}
{...props}
>
{children ?? (
<div
data-slot="timeline-dot"
className={cn("size-1.5 rounded-full", look.dot)}
/>
)}
</div>
)
}
/**
* The text of an entry, beside its mark. It leaves 32px of space before the
* next entry, and none after the last.
*/
function TimelineContent({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="timeline-content"
className={cn(
"min-w-0 flex-1 pb-8 [[data-slot=timeline-item]:last-child>&]:pb-0",
className
)}
{...props}
/>
)
}
/** The entry's title, in medium weight. It renders a `div`, not a heading. */
function TimelineTitle({ className, ...props }: ComponentProps<"div">) {
return (
<div
data-slot="timeline-title"
className={cn("font-medium", className)}
{...props}
/>
)
}
/** Supporting text for an entry, small and muted, under the title. */
function TimelineDescription({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="timeline-description"
className={cn("mt-1 text-sm text-muted-foreground", className)}
{...props}
/>
)
}
/**
* A small muted line for an entry, such as a date. Its line height matches
* the default `--timeline-lh`, so a label that comes first lines up with the
* mark.
*/
function TimelineLabel({ className, ...props }: ComponentProps<"p">) {
return (
<p
data-slot="timeline-label"
className={cn("text-xs/4 text-muted-foreground", className)}
{...props}
/>
)
}
export {
Timeline,
TimelineItem,
TimelineIndicator,
TimelineContent,
TimelineTitle,
TimelineDescription,
TimelineLabel,
}
Installation
npx shadcn@latest add @01orbital/commit-history-timeline-01Make it yours
- Its words are in
COPYat the top ofcomponents/blocks/timeline/commit-history-timeline-01/index.tsx: change them there, not in the markup. DAYS, also at the top of the file, holds its lists and settings.
Built from
Built from these parts. The CLI adds each one that is missing and won't replace a file you already have unless you choose to:
- Badge
- Eyebrow
font-geist-mono- App Timeline
The shadcn parts here are their Base UI versions, and this piece uses Base UI's API. A Radix version you already have won't work with it.
Last updated on