Timeline
Vertical activity timeline with toned icons that stagger in.
$
pnpm dlx shadcn@latest add https://lodeui.com/r/timeline.jsonDeployed to production
a91f2c4 · Reuse idempotency keyOlivia merged #482
Grace joined the team
Payment retry scheduled
Card declined; next attempt tomorrow 09:00
components/examples/timeline-demo.tsx
"use client";
import { CreditCard, GitMerge, Rocket, UserPlus } from "lucide-react";
import { Timeline } from "@/components/ui/timeline";
export default function TimelineDemo() {
return (
<Timeline
className="w-full max-w-md"
items={[
{ id: "1", icon: <Rocket />, tone: "success", title: <><b className="font-medium">Deployed</b> to production</>, time: "2m", description: "a91f2c4 · Reuse idempotency key" },
{ id: "2", icon: <GitMerge />, tone: "info", title: <><b className="font-medium">Olivia</b> merged #482</>, time: "14m" },
{ id: "3", icon: <UserPlus />, title: <><b className="font-medium">Grace</b> joined the team</>, time: "1h" },
{ id: "4", icon: <CreditCard />, tone: "warning", title: <>Payment retry scheduled</>, time: "3h", description: "Card declined; next attempt tomorrow 09:00" },
]}
/>
);
}When to use
- Activity feeds, audit trails, incident updates and order history.
When not to use
- Steps people must complete: use a stepper.
Installation
$
pnpm dlx shadcn@latest add https://lodeui.com/r/timeline.json1Install the dependencies
npm install motion2Copy the source into your project
components/ui/timeline.tsx"use client"; import * as React from "react"; import { motion } from "motion/react"; import { cn } from "@/lib/utils"; export interface TimelineItem { id: string; title: React.ReactNode; description?: React.ReactNode; time: string; icon?: React.ReactNode; tone?: "default" | "success" | "warning" | "danger" | "info"; } const toneCls = { default: "bg-muted text-muted-foreground", success: "bg-emerald-500/15 text-emerald-600 dark:text-emerald-400", warning: "bg-amber-500/15 text-amber-600 dark:text-amber-400", danger: "bg-destructive/15 text-destructive", info: "bg-sky-500/15 text-sky-600 dark:text-sky-400", }; /** A vertical activity timeline; items stagger in. */ export function Timeline({ items, className }: { items: TimelineItem[]; className?: string }) { return ( <ol className={cn("relative", className)}> {items.map((item, i) => ( <motion.li key={item.id} initial={{ opacity: 0, x: -6 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: i * 0.05, duration: 0.25 }} className="relative flex gap-3 pb-5 last:pb-0" > {i < items.length - 1 && <span className="absolute left-3.5 top-8 bottom-0 w-px bg-border" aria-hidden />} <span className={cn("relative z-10 grid size-7 shrink-0 place-items-center rounded-full ring-4 ring-background [&_svg]:size-3.5", toneCls[item.tone ?? "default"])}> {item.icon ?? <span className="size-1.5 rounded-full bg-current" />} </span> <div className="min-w-0 flex-1 pt-0.5"> <div className="flex items-baseline justify-between gap-3"> <p className="text-sm">{item.title}</p> <time className="shrink-0 text-xs text-muted-foreground">{item.time}</time> </div> {item.description && <div className="mt-1 text-sm text-muted-foreground">{item.description}</div>} </div> </motion.li> ))} </ol> ); }
Usage
Import it from @/components/ui/timeline after installing.
example.tsx
import { Timeline } from "@/components/ui/timeline";
export function Activity() {
return <Timeline items={[{ id: "1", title: "Deployed v2.4", time: "2m ago", tone: "success" }, { id: "2", title: "Build started", time: "6m ago" }]} />;
}API reference
Timeline
A vertical list of events with tone-colored markers.
| Prop | Type | Default | Description |
|---|---|---|---|
| items | { id; title; description?; time; icon?; tone? }[] | – | tone: default, success, warning, danger or info. |
Accessibility
- An ordered list; markers are decorative and the title carries the meaning.
Motion
- Items stagger in on mount.
Responsive behavior
- Single column; time sits under the title on narrow screens.
Performance
- Paginate long histories.
Notes for AI
- Newest first is the usual order for activity feeds.
This page as Markdown, for assistants and coding agents:
/components/timeline/markdownThe full library index for assistants is at /llms.txt.
Lode222 doc pagesllms.txt