Data display
Timeline
Items connect with a 1px rail; the last item drops the rail.
Preview
- Sarah Chen opened “Scaling outbound without adding headcount”2h ago · Series B — VP Sales · Step 1
- Sarah Chen clicked the case study link1h ago · Series B — VP Sales · Step 1
- Step 2 scheduled for Thu, 9:00 AMAutomated
import { Eye, MailOpen, Send } from "lucide-react";
import { Timeline } from "@/components/ui/timeline";
export default function Example() {
return (
<Timeline
className="w-full max-w-md"
items={[
{ id: "1", icon: <Eye />, title: "Sarah Chen opened “Scaling outbound without adding headcount”", meta: "2h ago · Series B — VP Sales · Step 1" },
{ id: "2", icon: <MailOpen />, title: "Sarah Chen clicked the case study link", meta: "1h ago · Series B — VP Sales · Step 1" },
{ id: "3", icon: <Send />, title: "Step 2 scheduled for Thu, 9:00 AM", meta: "Automated" },
]}
/>
);
}Installation
Components are copied into your project — no runtime package.
Create a
timeline.tsxfile and paste the following code into it.src/components/ui/timeline.tsximport type { ReactNode } from "react"; import { cx } from "@/utils/cx"; export interface TimelineItem { id: string; icon: ReactNode; title: ReactNode; meta?: ReactNode; } /** Items connect with a 1px rail; the last item drops the rail. */ export function Timeline({ items, className }: { items: TimelineItem[]; className?: string }) { return ( <ol className={cx("flex flex-col", className)}> {items.map((item, i) => ( <li key={item.id} className="relative flex gap-3 pb-5 last:pb-0"> {i < items.length - 1 && <span aria-hidden className="absolute bottom-0 left-[11px] top-7 w-px bg-line" />} <span className="relative z-10 flex size-6 shrink-0 items-center justify-center rounded-full bg-surface text-fg-secondary shadow-button [&_svg]:size-3.5"> {item.icon} </span> <div className="min-w-0 pt-0.5"> <div className="text-base text-fg">{item.title}</div> {item.meta && <div className="mt-1 text-sm text-fg-muted">{item.meta}</div>} </div> </li> ))} </ol> ); }Add the theme tokens and the
cxhelper from Installation if you haven’t yet, then update the import paths to match your project setup.