Timeline
A list of events joined by a line, vertical or horizontal, with a status for each step: done, in progress or still to come. For activity feeds, changelogs, order tracking and roadmaps.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/timeline.json4 examples below; each installs the component with it. They wear whichever DressCode theme you install.
npx shadcn@latest add https://dresscodeui.com/r/dresscode/timeline-activity.jsoncomponents/dresscode/timeline-activity.tsx
// An activity feed: who did what and when, with an icon per kind of event and a way to load more.
import { CreditCard, FileText, Mail, MessageSquare, UserPlus } from "lucide-react"
import { Avatar, AvatarFallback } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {
Timeline,
TimelineContent,
TimelineDescription,
TimelineHeader,
TimelineIndicator,
TimelineItem,
TimelineSeparator,
TimelineTime,
TimelineTitle,
} from "@/components/ui/timeline"
const EVENTS = [
{ icon: CreditCard, who: "Kato & Lee", what: "paid INV-1041", detail: "$1,860.00 by card, 4 days after the reminder.", when: "10 min ago", at: "2026-11-24T09:50" },
{ icon: Mail, who: "Orbit", what: "sent a reminder to Pellucid Health", detail: "INV-1036 is 15 days late. The next one goes out on Friday.", when: "1 hour ago", at: "2026-11-24T09:00" },
{ icon: MessageSquare, who: "Tom Okafor", what: "commented on INV-1042", detail: "“Can we split this into two payments?”", when: "Yesterday", at: "2026-11-23T16:12", initials: "TO" },
{ icon: FileText, who: "Ada Lin", what: "created INV-1043 for Fernwood Studio", detail: "$4,200.00, due Dec 8.", when: "Nov 22", at: "2026-11-22T11:30", initials: "AL" },
{ icon: UserPlus, who: "Maya Lindqvist", what: "joined the workspace as an editor", when: "Nov 21", at: "2026-11-21T08:05", initials: "ML" },
]
export default function TimelineActivity() {
return (
<div className="w-full max-w-xl">
<h2 className="mb-5 text-base font-semibold">Activity</h2>
<Timeline>
{EVENTS.map((e) => (
<TimelineItem key={e.at}>
<TimelineSeparator />
<TimelineIndicator>
{e.initials ? (
<Avatar className="size-full">
<AvatarFallback className="text-[11px]">{e.initials}</AvatarFallback>
</Avatar>
) : (
<e.icon />
)}
</TimelineIndicator>
<TimelineContent>
<TimelineHeader>
<TimelineTitle>
{e.who} <span className="font-normal text-muted-foreground">{e.what}</span>
</TimelineTitle>
<TimelineTime dateTime={e.at}>{e.when}</TimelineTime>
</TimelineHeader>
{e.detail ? <TimelineDescription>{e.detail}</TimelineDescription> : null}
</TimelineContent>
</TimelineItem>
))}
</Timeline>
<Button variant="outline" size="sm" className="mt-6 ml-12">
Load older activity
</Button>
</div>
)
}npx shadcn@latest add https://dresscodeui.com/r/dresscode/timeline-changelog.jsoncomponents/dresscode/timeline-changelog.tsx
// A changelog: one entry per release, the date and version on the left, what changed on the right.
import { Badge } from "@/components/ui/badge"
import { Timeline, TimelineContent, TimelineDot, TimelineItem, TimelineSeparator, TimelineTitle } from "@/components/ui/timeline"
const RELEASES = [
{
version: "2.4.0",
date: "Nov 24, 2026",
title: "Reminders in your own words",
changes: [
{ kind: "New", text: "Write the first reminder yourself; the rest keep your tone." },
{ kind: "New", text: "Late fees, applied politely after the date you pick." },
{ kind: "Fixed", text: "Reminders no longer go out on public holidays." },
],
},
{
version: "2.3.0",
date: "Nov 10, 2026",
title: "Recurring invoices",
changes: [
{ kind: "New", text: "Retainers that bill themselves every month and stop when the contract ends." },
{ kind: "Improved", text: "The invoice editor remembers your last tax rate per client." },
],
},
{
version: "2.2.1",
date: "Oct 28, 2026",
title: "Fixes",
changes: [
{ kind: "Fixed", text: "PDF totals now round the same way as the screen." },
{ kind: "Fixed", text: "Search found archived clients twice." },
],
},
]
const TONE: Record<string, "default" | "secondary" | "outline"> = { New: "default", Improved: "secondary", Fixed: "outline" }
export default function TimelineChangelog() {
return (
<Timeline className="w-full max-w-2xl">
{RELEASES.map((r, i) => (
<TimelineItem key={r.version} status={i === 0 ? "current" : "done"} className="sm:gap-6">
<div className="hidden w-28 shrink-0 pt-1 text-right sm:block">
<p className="text-sm font-medium">{r.date}</p>
<p className="text-xs text-muted-foreground">v{r.version}</p>
</div>
<TimelineSeparator className="sm:left-[calc(9.5rem-0.5px)]!" />
<TimelineDot />
<TimelineContent className="pb-2">
<p className="text-xs text-muted-foreground sm:hidden">
{r.date} · v{r.version}
</p>
<TimelineTitle className="text-base">{r.title}</TimelineTitle>
<ul className="mt-3 space-y-2">
{r.changes.map((c) => (
<li key={c.text} className="flex items-start gap-2 text-sm">
<Badge variant={TONE[c.kind]} className="mt-0.5 w-[4.75rem] shrink-0 justify-center">
{c.kind}
</Badge>
<span className="text-muted-foreground">{c.text}</span>
</li>
))}
</ul>
</TimelineContent>
</TimelineItem>
))}
</Timeline>
)
}npx shadcn@latest add https://dresscodeui.com/r/dresscode/timeline-order-tracking.jsoncomponents/dresscode/timeline-order-tracking.tsx
// Order tracking: steps that are done, the one in progress, and what is still to come.
import { Check, Home, Package, PackageCheck, Truck } from "lucide-react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Progress } from "@/components/ui/progress"
import {
Timeline,
TimelineContent,
TimelineDescription,
TimelineHeader,
TimelineIndicator,
TimelineItem,
TimelineSeparator,
TimelineTime,
TimelineTitle,
} from "@/components/ui/timeline"
const STEPS = [
{ icon: PackageCheck, title: "Order placed", note: "Payment confirmed.", time: "Nov 21, 09:14", status: "done" },
{ icon: Package, title: "Packed", note: "Two boxes, 3.4 kg.", time: "Nov 22, 16:40", status: "done" },
{ icon: Truck, title: "In transit", note: "Left the Leeds depot. Next stop: Manchester.", time: "Nov 24, 07:02", status: "current" },
{ icon: Truck, title: "Out for delivery", note: "Expected Nov 25, 9:00 to 13:00.", status: "upcoming" },
{ icon: Home, title: "Delivered", status: "upcoming" },
] as const
export default function TimelineOrderTracking() {
return (
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Order #48213</CardTitle>
<CardDescription>Arriving tomorrow, Nov 25</CardDescription>
<Progress value={58} aria-label="Delivery progress" className="mt-3" />
</CardHeader>
<CardContent>
<Timeline>
{STEPS.map((s) => (
<TimelineItem key={s.title} status={s.status}>
<TimelineSeparator />
<TimelineIndicator>{s.status === "done" ? <Check /> : <s.icon />}</TimelineIndicator>
<TimelineContent>
<TimelineHeader className="justify-between">
<TimelineTitle>{s.title}</TimelineTitle>
{"time" in s ? <TimelineTime>{s.time}</TimelineTime> : null}
</TimelineHeader>
{"note" in s ? <TimelineDescription>{s.note}</TimelineDescription> : null}
</TimelineContent>
</TimelineItem>
))}
</Timeline>
</CardContent>
</Card>
)
}npx shadcn@latest add https://dresscodeui.com/r/dresscode/timeline-milestones.jsoncomponents/dresscode/timeline-milestones.tsx
// A horizontal roadmap: milestones left to right, scrolling sideways on narrow screens.
import { Badge } from "@/components/ui/badge"
import {
Timeline,
TimelineContent,
TimelineDescription,
TimelineIndicator,
TimelineItem,
TimelineSeparator,
TimelineTime,
TimelineTitle,
} from "@/components/ui/timeline"
const MILESTONES = [
{ quarter: "Q1 2026", title: "Invoices", note: "Send, track and get paid by card.", status: "done" },
{ quarter: "Q2 2026", title: "Reminders", note: "Automatic follow-ups in your tone.", status: "done" },
{ quarter: "Q3 2026", title: "Recurring billing", note: "Retainers that bill themselves.", status: "done" },
{ quarter: "Q4 2026", title: "Multi-currency", note: "Bill in 30 currencies.", status: "current" },
{ quarter: "Q1 2027", title: "Accounting sync", note: "Two-way sync with your books.", status: "upcoming" },
] as const
export default function TimelineMilestones() {
return (
<section aria-labelledby="roadmap" className="w-full max-w-4xl">
<div className="mb-6 flex items-center justify-between gap-4">
<h2 id="roadmap" className="text-base font-semibold">
Roadmap
</h2>
<Badge variant="secondary">Updated Nov 24</Badge>
</div>
<Timeline orientation="horizontal">
{MILESTONES.map((m, i) => (
<TimelineItem key={m.title} status={m.status}>
<TimelineSeparator />
<TimelineIndicator>{i + 1}</TimelineIndicator>
<TimelineContent className="pt-0">
<TimelineTime>{m.quarter}</TimelineTime>
<TimelineTitle className="mt-0.5">{m.title}</TimelineTitle>
<TimelineDescription>{m.note}</TimelineDescription>
</TimelineContent>
</TimelineItem>
))}
</Timeline>
</section>
)
}The component
What shadcn@latest add https://dresscodeui.com/r/dresscode/timeline.json writes. It uses only shadcn/ui's variables, so it follows the theme.
components/ui/timeline.tsx
// Timeline: a list of events joined by a line. Vertical by default, horizontal for roadmaps.
// Each item has an indicator (a dot, an icon or a number) whose look follows its status:
// "done" fills with the primary color, "current" rings it, "upcoming" stays quiet.
// Built for shadcn/ui; reads only the theme's variables.
import * as React from "react"
import { cn } from "@/lib/utils"
type Orientation = "vertical" | "horizontal"
type Status = "done" | "current" | "upcoming"
function Timeline({ className, orientation = "vertical", ...props }: React.ComponentProps<"ol"> & { orientation?: Orientation }) {
return (
<ol
data-slot="timeline"
data-orientation={orientation}
className={cn("group/timeline flex", orientation === "vertical" ? "flex-col" : "flex-row overflow-x-auto pb-2", className)}
{...props}
/>
)
}
function TimelineItem({ className, status, ...props }: React.ComponentProps<"li"> & { status?: Status }) {
return (
<li
data-slot="timeline-item"
data-status={status}
className={cn(
"group/timeline-item relative flex gap-4",
// vertical: indicator column on the left, the line runs down from it to the next item
"group-data-[orientation=vertical]/timeline:pb-8 group-data-[orientation=vertical]/timeline:last:pb-0",
// horizontal: indicator on top, the line runs right
"group-data-[orientation=horizontal]/timeline:min-w-40 group-data-[orientation=horizontal]/timeline:flex-1 group-data-[orientation=horizontal]/timeline:flex-col group-data-[orientation=horizontal]/timeline:gap-3 group-data-[orientation=horizontal]/timeline:pr-6",
className,
)}
{...props}
/>
)
}
/** The line between this item and the next. Put it inside a TimelineItem; hidden on the last one. */
function TimelineSeparator({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
aria-hidden="true"
data-slot="timeline-separator"
className={cn(
"absolute bg-border group-last/timeline-item:hidden",
"group-data-[orientation=vertical]/timeline:top-8 group-data-[orientation=vertical]/timeline:bottom-0 group-data-[orientation=vertical]/timeline:left-[calc(--spacing(4)-0.5px)] group-data-[orientation=vertical]/timeline:w-px",
"group-data-[orientation=horizontal]/timeline:top-[calc(--spacing(4)-0.5px)] group-data-[orientation=horizontal]/timeline:right-0 group-data-[orientation=horizontal]/timeline:left-10 group-data-[orientation=horizontal]/timeline:h-px",
"group-data-[status=done]/timeline-item:bg-primary",
className,
)}
{...props}
/>
)
}
function TimelineIndicator({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
data-slot="timeline-indicator"
className={cn(
"relative z-10 flex size-8 shrink-0 items-center justify-center rounded-full border bg-background text-xs font-semibold text-muted-foreground [&_svg]:size-4",
"group-data-[status=done]/timeline-item:border-primary group-data-[status=done]/timeline-item:bg-primary group-data-[status=done]/timeline-item:text-primary-foreground",
"group-data-[status=current]/timeline-item:border-primary group-data-[status=current]/timeline-item:text-primary group-data-[status=current]/timeline-item:ring-4 group-data-[status=current]/timeline-item:ring-primary/15",
className,
)}
{...props}
/>
)
}
/** A small dot instead of the 32px indicator, for dense feeds. */
function TimelineDot({ className, ...props }: React.ComponentProps<"span">) {
return (
<span data-slot="timeline-dot" className={cn("relative z-10 flex size-8 shrink-0 items-center justify-center", className)} {...props}>
<span className="size-2.5 rounded-full bg-muted-foreground/50 ring-4 ring-background group-data-[status=current]/timeline-item:bg-primary group-data-[status=done]/timeline-item:bg-primary" />
</span>
)
}
function TimelineContent({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="timeline-content" className={cn("min-w-0 flex-1 pt-1", className)} {...props} />
}
function TimelineHeader({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="timeline-header" className={cn("flex flex-wrap items-baseline gap-x-2 gap-y-0.5", className)} {...props} />
}
function TimelineTitle({ className, ...props }: React.ComponentProps<"h3">) {
return (
<h3
data-slot="timeline-title"
className={cn("text-sm leading-6 font-medium group-data-[status=upcoming]/timeline-item:text-muted-foreground", className)}
{...props}
/>
)
}
function TimelineTime({ className, ...props }: React.ComponentProps<"time">) {
return <time data-slot="timeline-time" className={cn("text-xs text-muted-foreground tabular-nums", className)} {...props} />
}
function TimelineDescription({ className, ...props }: React.ComponentProps<"div">) {
return <div data-slot="timeline-description" className={cn("mt-1 text-sm text-muted-foreground", className)} {...props} />
}
export {
Timeline,
TimelineContent,
TimelineDescription,
TimelineDot,
TimelineHeader,
TimelineIndicator,
TimelineItem,
TimelineSeparator,
TimelineTime,
TimelineTitle,
}