Skip to content
WANCRAFT

G.58Data & Feedback

Activity Timeline

A vertical timeline whose line fills to the current step, with staggered reveal and collapsible notes.

NewReactMotionCSSTailwindintermediate

Overview

Activity Timeline renders events as a semantic ordered list. Each item has a status — done, active, pending or error — shown by marker shape and a text label (screen-reader text on every item, a visible badge on active and failed ones), never by colour alone. The connecting line fills segment by segment up to the active item the first time the list scrolls into view and animates forward as statuses change; items reveal with a stagger once; the active marker pulses only while it is on screen and the tab is visible. Long descriptions clamp to a few lines with a Show more toggle that appears only when the text actually overflows, and times render as <time dateTime> elements.

01Installation

Method 01 · Registry

CLI verified

Uses the shadcn CLI in a project initialised with shadcn init. Installs the file to components/ui/activity-timeline.tsx and adds its dependencies.

npx shadcn@latest add https://wancraft.my/r/activity-timeline.json

Method 02 · Copy and paste

  1. 1. Install the dependencies below.
  2. 2. Copy the source from the Code tab into components/ui/activity-timeline.tsx.
  3. 3. Import it and adjust props.
npm install motion
Dependencies
motion
Peer
react ≥ 18, tailwindcss ≥ 4
Added
13 Oct 2026
Updated
—

02Usage

The default configuration. Change properties above to generate a tailored example in the Usage tab.

example.tsx
import { ActivityTimeline, type TimelineItem } from "@/components/ui/activity-timeline";

export function ActivityTimelineExample() {
  const items: TimelineItem[] = [
    { id: "push", title: "Commit pushed", time: "09:41", dateTime: "09:41", status: "done" },
    { id: "test", title: "Run tests", description: "148 tests across 24 files.", time: "09:42", dateTime: "09:42", status: "done" },
    { id: "build", title: "Build", description: "Compiling 64 static pages.", status: "active" },
    { id: "deploy", title: "Deploy", status: "pending" },
  ];

  return (
    <div className="w-full max-w-md">
      <ActivityTimeline items={items} label="Deploy pipeline" />
    </div>
  );
}

03Props

PropTypeDefaultDescription
itemsTimelineItem[]—{ id; title: ReactNode; description?: ReactNode; time?: string; dateTime?: string; status: "done" | "active" | "pending" | "error"; icon?: ReactNode }.
labelstring"Activity"Accessible name of the ordered list.
staggernumber80Delay between items on reveal, in ms.
revealOnViewbooleantrueReveal items and fill the line the first time the list enters the viewport.
collapsedLinesnumber2Clamp descriptions to N lines with a Show more toggle; 0 never clamps.
density"comfortable" | "compact""comfortable"Marker size and spacing.
showTimebooleantrueShow item times (rendered as <time> when dateTime is set).
accentstring"#FF7448"Line fill, done/active markers and focus ring.
statusLabelsPartial<Record<Status, string>>Completed / In progress / Pending / FailedText that conveys each status.

04Features

  • 01Line fills segment by segment up to the active (or failed) item and animates forward on change
  • 02Items reveal with a stagger once, the first time they scroll into view
  • 03Active marker pulse that pauses offscreen and in hidden tabs
  • 04Descriptions clamp to N lines; the toggle appears only when text overflows
  • 05Custom marker icons, compact density and status labels
motion · staggermotion · tweenmotion · continuousinput · viewportinput · click

05Accessibility

  • Semantic <ol> with an accessible name; the active item has aria-current="step".
  • Every item starts with screen-reader status text ("Completed: …"); markers also differ in shape, so status never relies on colour.
  • Times use <time dateTime> when a machine-readable value is provided.
  • Show more / Show less is a button with aria-expanded and aria-controls.
  • prefers-reduced-motion shows items immediately, fills the line instantly and removes the pulse.