# Shadcn Timeline

A list of events in order, each with a marker, a connecting line, a title, a time and a description. Events can be marked complete, current or upcoming, run vertically or horizontally, and turn into an accessible feed that loads more as people scroll. Arrow keys move between events and every event is named by its title for screen readers.

`timeline-demo.tsx`:

```tsx
import {
  Timeline,
  TimelineConnector,
  TimelineDescription,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";

export default function TimelineDemo() {
  return (
    <Timeline aria-label="Order history" className="max-w-xs">
      <TimelineItem status="complete">
        <TimelineMarker />
        <TimelineConnector />
        <TimelineTitle>Order placed</TimelineTitle>
        <TimelineTime dateTime="2026-11-20">Nov 20</TimelineTime>
        <TimelineDescription>We received your order.</TimelineDescription>
      </TimelineItem>
      <TimelineItem status="current">
        <TimelineMarker />
        <TimelineConnector />
        <TimelineTitle>Shipped</TimelineTitle>
        <TimelineTime dateTime="2026-11-22">Nov 22</TimelineTime>
        <TimelineDescription>Your package is on the way.</TimelineDescription>
      </TimelineItem>
      <TimelineItem status="upcoming">
        <TimelineMarker />
        <TimelineConnector />
        <TimelineTitle>Delivered</TimelineTitle>
        <TimelineTime dateTime="2026-11-25">Expected Nov 25</TimelineTime>
      </TimelineItem>
    </Timeline>
  );
}
```

## Installation

```bash
npx shadcn@latest add @shadcnuikit/timeline1
```

This adds `components/ui/timeline.tsx` and a demo file. Set up the registry once as described in [Shadcn CLI](https://shadcnuikit.com/docs/shadcn-cli). Timeline is free and installs without an API key.

### Manual installation

Install the dependencies:

```bash
npm install @ui-sdk/react@beta
```

Copy the source into `components/ui/timeline.tsx`:

`components/ui/timeline.tsx`:

```tsx
"use client";

import * as React from "react";
import {
  Timeline as TimelinePrimitive,
  TimelineConnector as TimelineConnectorPrimitive,
  TimelineDescription as TimelineDescriptionPrimitive,
  TimelineItem as TimelineItemPrimitive,
  TimelineMarker as TimelineMarkerPrimitive,
  TimelineTime as TimelineTimePrimitive,
  TimelineTitle as TimelineTitlePrimitive,
  createTimelineController,
  type TimelineStatus,
} from "@ui-sdk/react/timeline";

import { cn } from "@/lib/utils";

type WithClassName<T> = Omit<T, "className"> & { className?: string };

function Timeline({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelinePrimitive>>) {
  return (
    <TimelinePrimitive
      className={cn("flex w-full flex-col data-horizontal:flex-row", className)}
      {...props}
    />
  );
}

function TimelineItem({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineItemPrimitive>>) {
  return (
    <TimelineItemPrimitive
      className={cn(
        "group/timeline-item relative flex flex-col gap-0.5 rounded-sm ps-9 pb-8 outline-none last:pb-0 data-last:pb-0",
        "focus-visible:outline-ring/50 focus-visible:outline-2 focus-visible:outline-offset-4",
        "data-horizontal:flex-1 data-horizontal:ps-0 data-horizontal:pe-6 data-horizontal:pt-9 data-horizontal:pb-0 data-horizontal:last:pe-0",
        className,
      )}
      {...props}
    />
  );
}

function TimelineMarker({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineMarkerPrimitive>>) {
  return (
    <TimelineMarkerPrimitive
      className={cn(
        "bg-background border-border text-muted-foreground absolute start-0 top-0 z-10 flex size-6 items-center justify-center rounded-full border-2 [&_svg:not([class*='size-'])]:size-3.5",
        "empty:after:bg-muted-foreground/50 empty:after:size-2 empty:after:rounded-full empty:after:content-['']",
        "data-complete:bg-primary data-complete:border-primary data-complete:text-primary-foreground data-complete:after:bg-primary-foreground",
        "data-current:border-primary data-current:text-primary data-current:ring-primary/15 data-current:ring-4 data-current:after:bg-primary",
        className,
      )}
      {...props}
    />
  );
}

function TimelineConnector({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineConnectorPrimitive>>) {
  return (
    <TimelineConnectorPrimitive
      className={cn(
        "bg-border absolute start-[calc(0.75rem-1px)] top-7 bottom-1 w-0.5 rounded-full",
        "group-last/timeline-item:hidden group-data-last/timeline-item:hidden",
        "data-complete:bg-primary",
        "data-horizontal:start-7 data-horizontal:end-1 data-horizontal:top-[calc(0.75rem-1px)] data-horizontal:bottom-auto data-horizontal:h-0.5 data-horizontal:w-auto",
        className,
      )}
      {...props}
    />
  );
}

function TimelineTitle({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineTitlePrimitive>>) {
  return (
    <TimelineTitlePrimitive
      className={cn(
        "text-foreground text-sm leading-6 font-medium data-upcoming:text-muted-foreground",
        className,
      )}
      {...props}
    />
  );
}

function TimelineTime({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineTimePrimitive>>) {
  return (
    <TimelineTimePrimitive
      className={cn("text-muted-foreground text-xs", className)}
      {...props}
    />
  );
}

function TimelineDescription({
  className,
  ...props
}: WithClassName<React.ComponentProps<typeof TimelineDescriptionPrimitive>>) {
  return (
    <TimelineDescriptionPrimitive
      className={cn("text-muted-foreground mt-1 text-sm", className)}
      {...props}
    />
  );
}

export {
  Timeline,
  TimelineConnector,
  TimelineDescription,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
  createTimelineController,
};
export type { TimelineStatus };
```

## Usage

```tsx
import {
  Timeline,
  TimelineConnector,
  TimelineDescription,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";
```

```tsx
<Timeline aria-label="Order history">
  <TimelineItem status="complete">
    <TimelineMarker />
    <TimelineConnector />
    <TimelineTitle>Order placed</TimelineTitle>
    <TimelineTime dateTime="2026-11-20">Nov 20</TimelineTime>
    <TimelineDescription>We received your order.</TimelineDescription>
  </TimelineItem>
</Timeline>
```

Give the timeline a name with `aria-label` or `aria-labelledby`. Put `TimelineMarker` and `TimelineConnector` first in each item. They are positioned absolutely, and the connector hides itself on the last item.

### Status

```tsx
<TimelineItem status="current">...</TimelineItem>
```

`status` is set on the item and every part inside reads it. Leave it out for plain activity logs that have no progress.

## Examples

### Basic

Without a `status`, every marker shows a muted dot.

`timeline-basic.tsx`:

```tsx
import {
  Timeline,
  TimelineConnector,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";

const events = [
  { title: "Project created", dateTime: "2026-11-01", time: "Nov 1" },
  { title: "First commit pushed", dateTime: "2026-11-03", time: "Nov 3" },
  { title: "Preview deployed", dateTime: "2026-11-04", time: "Nov 4" },
];

export default function TimelineBasic() {
  return (
    <Timeline aria-label="Project activity" className="max-w-xs">
      {events.map((event) => (
        <TimelineItem key={event.title}>
          <TimelineMarker />
          <TimelineConnector />
          <TimelineTitle>{event.title}</TimelineTitle>
          <TimelineTime dateTime={event.dateTime}>{event.time}</TimelineTime>
        </TimelineItem>
      ))}
    </Timeline>
  );
}
```

### Status

`status` accepts `complete`, `current` and `upcoming`. Complete fills the marker and the connector, current adds a ring, upcoming mutes the title.

`timeline-status.tsx`:

```tsx
import {
  Timeline,
  TimelineConnector,
  TimelineItem,
  TimelineMarker,
  TimelineTitle,
  type TimelineStatus,
} from "@/components/ui/timeline";

const steps: { title: string; status: TimelineStatus }[] = [
  { title: "Complete", status: "complete" },
  { title: "Current", status: "current" },
  { title: "Upcoming", status: "upcoming" },
];

export default function TimelineStatusExample() {
  return (
    <Timeline aria-label="Status" className="max-w-xs">
      {steps.map((step) => (
        <TimelineItem key={step.title} status={step.status}>
          <TimelineMarker />
          <TimelineConnector />
          <TimelineTitle>{step.title}</TimelineTitle>
        </TimelineItem>
      ))}
    </Timeline>
  );
}
```

### Horizontal

`orientation="horizontal"` lays the events out in a row. Left and right arrow keys move between them.

`timeline-horizontal.tsx`:

```tsx
import {
  Timeline,
  TimelineConnector,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
  type TimelineStatus,
} from "@/components/ui/timeline";

const milestones: { title: string; dateTime: string; time: string; status: TimelineStatus }[] = [
  { title: "Kickoff", dateTime: "2026-01", time: "January", status: "complete" },
  { title: "Beta", dateTime: "2026-05", time: "May", status: "current" },
  { title: "Launch", dateTime: "2026-09", time: "September", status: "upcoming" },
];

export default function TimelineHorizontal() {
  return (
    <Timeline orientation="horizontal" aria-label="Roadmap" className="max-w-md">
      {milestones.map((milestone) => (
        <TimelineItem key={milestone.title} status={milestone.status}>
          <TimelineMarker />
          <TimelineConnector />
          <TimelineTitle>{milestone.title}</TimelineTitle>
          <TimelineTime dateTime={milestone.dateTime}>{milestone.time}</TimelineTime>
        </TimelineItem>
      ))}
    </Timeline>
  );
}
```

### Icon

Put an icon inside `TimelineMarker` instead of the default dot. Icons get `size-3.5` unless you set a size.

`timeline-icon.tsx`:

```tsx
import { CheckIcon, GitMergeIcon, MessageSquareIcon } from "lucide-react";
import {
  Timeline,
  TimelineConnector,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";

export default function TimelineIcon() {
  return (
    <Timeline aria-label="Pull request activity" className="max-w-xs">
      <TimelineItem status="complete">
        <TimelineMarker>
          <MessageSquareIcon aria-hidden="true" />
        </TimelineMarker>
        <TimelineConnector />
        <TimelineTitle>Review requested</TimelineTitle>
        <TimelineTime dateTime="2026-11-18">Nov 18</TimelineTime>
      </TimelineItem>
      <TimelineItem status="complete">
        <TimelineMarker>
          <CheckIcon aria-hidden="true" />
        </TimelineMarker>
        <TimelineConnector />
        <TimelineTitle>Changes approved</TimelineTitle>
        <TimelineTime dateTime="2026-11-19">Nov 19</TimelineTime>
      </TimelineItem>
      <TimelineItem status="current">
        <TimelineMarker>
          <GitMergeIcon aria-hidden="true" />
        </TimelineMarker>
        <TimelineConnector />
        <TimelineTitle>Ready to merge</TimelineTitle>
        <TimelineTime dateTime="2026-11-20">Nov 20</TimelineTime>
      </TimelineItem>
    </Timeline>
  );
}
```

### Feed

`feed` turns the timeline into a feed of articles with their position and the total. Set `busy` while new events load.

`timeline-feed.tsx`:

```tsx
"use client";

import * as React from "react";
import { Button } from "@/components/ui/button";
import {
  Timeline,
  TimelineConnector,
  TimelineDescription,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";

const updates = [
  { id: "1", title: "Search is faster", dateTime: "2026-11-10", time: "Nov 10" },
  { id: "2", title: "Dark mode for emails", dateTime: "2026-11-08", time: "Nov 8" },
  { id: "3", title: "New billing page", dateTime: "2026-11-05", time: "Nov 5" },
  { id: "4", title: "Keyboard shortcuts", dateTime: "2026-11-02", time: "Nov 2" },
];

export default function TimelineFeed() {
  const [count, setCount] = React.useState(2);
  const [busy, setBusy] = React.useState(false);

  function loadMore() {
    setBusy(true);
    setTimeout(() => {
      setCount(updates.length);
      setBusy(false);
    }, 600);
  }

  return (
    <div className="flex w-full max-w-xs flex-col gap-6">
      <Timeline feed busy={busy} aria-label="Product updates">
        {updates.slice(0, count).map((update) => (
          <TimelineItem key={update.id} value={update.id}>
            <TimelineMarker />
            <TimelineConnector />
            <TimelineTitle>{update.title}</TimelineTitle>
            <TimelineTime dateTime={update.dateTime}>{update.time}</TimelineTime>
            <TimelineDescription>Read the full release note.</TimelineDescription>
          </TimelineItem>
        ))}
      </Timeline>
      <Button variant="outline" size="sm" className="self-start" disabled={busy || count === updates.length} onClick={loadMore}>
        {busy ? "Loading" : "Load more"}
      </Button>
    </div>
  );
}
```

### Controller

`createTimelineController()` moves focus to an event by its `value` from outside the timeline.

`timeline-controller.tsx`:

```tsx
"use client";

import * as React from "react";
import { Button } from "@/components/ui/button";
import {
  Timeline,
  TimelineConnector,
  TimelineItem,
  TimelineMarker,
  TimelineTitle,
  createTimelineController,
  type TimelineStatus,
} from "@/components/ui/timeline";

const steps: { value: string; title: string; status: TimelineStatus }[] = [
  { value: "draft", title: "Draft", status: "complete" },
  { value: "review", title: "In review", status: "complete" },
  { value: "approved", title: "Approved", status: "current" },
  { value: "published", title: "Published", status: "upcoming" },
];

export default function TimelineControllerExample() {
  const [controller] = React.useState(() => createTimelineController());

  return (
    <div className="flex w-full max-w-xs flex-col gap-6">
      <Timeline controller={controller} aria-label="Article status">
        {steps.map((step) => (
          <TimelineItem key={step.value} value={step.value} status={step.status}>
            <TimelineMarker />
            <TimelineConnector />
            <TimelineTitle>{step.title}</TimelineTitle>
          </TimelineItem>
        ))}
      </Timeline>
      <Button variant="outline" size="sm" className="self-start" onClick={() => controller.focus("approved")}>
        Jump to current step
      </Button>
    </div>
  );
}
```

More layouts built with Timeline, such as order tracking, changelogs and repository activity, are on the [Timeline components](https://shadcnuikit.com/components/timeline) page.

## API Reference

### Timeline

The root. Renders a `div` with `role="list"`, or `role="feed"` with `feed`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `orientation` | `"vertical"`, `"horizontal"` | `"vertical"` | Which way the events run, which also picks the arrow keys that move between them. |
| `loop` | `boolean` | `true` | Whether arrow keys wrap from the last event to the first. |
| `feed` | `boolean` | `false` | Makes the events a feed. Each event becomes an article with `aria-posinset` and `aria-setsize`. |
| `busy` | `boolean` | `false` | Sets `aria-busy` while a feed loads or changes events. Only a feed reads it. |
| `controller` | `TimelineController` | | Focuses an event from anywhere. Create one with `createTimelineController()`. |
| `render` | `ReactElement`, `(props, state) => ReactNode` | | Renders your own element. |
| `className` | `string` | | Classes for the root. |

The root has `data-orientation` and, for a busy feed, `data-busy`. It also sets a `--timeline-count` CSS variable with the number of events.

### TimelineItem

One event. Renders a `div` with `role="listitem"`, or `role="article"` in a feed.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `status` | `"complete"`, `"current"`, `"upcoming"` | | Where the event stands in a process. `current` sets `aria-current="step"` and takes the tab stop first. |
| `value` | `string` | generated | Names the event for the controller's `focus()`. |
| `className` | `string` | | Classes for the item. |

The item and every part inside it get `data-complete`, `data-current` or `data-upcoming` from its status, plus `data-orientation`. The first and last items get `data-first` and `data-last`, and each item sets a `--timeline-index` CSS variable.

### TimelineMarker

The circle on the line. Shows a dot when empty, or any icon you pass as children. Hidden from screen readers.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | | Classes for the marker, such as a size or a color. |

### TimelineConnector

The line to the next event. Hidden on the last item and hidden from screen readers.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | | Classes for the line. Move it with `start-*` and `top-*` when you change the marker size. |

### TimelineTitle

The event name. Its id names the item through `aria-labelledby`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | | Classes for the title. |

### TimelineTime

A `time` element. Pass a machine readable `dateTime`. It describes the item through `aria-describedby`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `dateTime` | `string` | | The date or time in a machine readable format, like `2026-11-20`. |
| `className` | `string` | | Classes for the time. |

### TimelineDescription

Extra text for the event. It also describes the item through `aria-describedby`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | | Classes for the description. |

### createTimelineController

```tsx
const [controller] = React.useState(() => createTimelineController());

<Timeline aria-label="Activity" controller={controller}>...</Timeline>;

controller.focus("approved");
controller.focus();
```

`focus(value)` moves focus to the event with that `value`. Without a value, it focuses the event that holds the tab stop.

## Keyboard

| Key | Action |
| --- | --- |
| `Tab` | Moves focus into the timeline, to the `current` event or the first one. |
| `ArrowDown`, `ArrowUp` | Moves to the next or previous event in a vertical timeline. |
| `ArrowRight`, `ArrowLeft` | Moves to the next or previous event in a horizontal timeline. Flips in right to left layouts. |
| `Home`, `End` | Moves to the first or last event. |
| `PageDown`, `PageUp` | In a feed, moves to the next or previous article from anywhere inside one. |

## Accessibility

- The root is a list and each event a list item, or a feed of articles with `feed`. In a feed, each article reads its position, such as "2 of 4".
- Each event is named by its `TimelineTitle` and described by its `TimelineTime` and `TimelineDescription`.
- The `current` event has `aria-current="step"`. Markers and connectors are `aria-hidden`.
- Only one event is in the tab order at a time, so a long timeline is a single `Tab` stop.
- Always give the timeline a name with `aria-label` or `aria-labelledby`. A feed without a name logs a warning in development.

## For AI Agents

**When to use**

- Activity logs, audit trails and changelogs, ordered by time.
- Progress of a process that already happened or is in motion, such as order tracking or deployment status, with `status`.
- Roadmaps and milestones in a row, with `orientation="horizontal"`.
- Infinite lists of updates, with `feed` and `busy`.

**When not to use**

- A form or wizard the user moves through step by step. Use a [Stepper](https://shadcnuikit.com/components/stepper).
- A plain list with no order in time. Use a normal list or a [Table](https://shadcnuikit.com/components/table).
- Chat messages. Use the [Chat UI](https://shadcnuikit.com/blocks/application-ui/chat-ui) blocks.

**Agent notes**

- Import from `@/components/ui/timeline`. The exports are `Timeline`, `TimelineItem`, `TimelineMarker`, `TimelineConnector`, `TimelineTitle`, `TimelineTime`, `TimelineDescription`, `createTimelineController` and the `TimelineStatus` type.
- Set `status` on `TimelineItem` only. The marker, connector, title, time and description read it from the item.
- Put `TimelineMarker` and `TimelineConnector` inside each item. The item has `ps-9` (or `pt-9` when horizontal) to make room for them.
- When you change the marker size, move the connector with `start-*` and `top-*` and the item padding with `ps-*` so the line stays centered.
- Always pass `dateTime` to `TimelineTime` and an `aria-label` to `Timeline`.
- The file is a client component (`"use client"`), but you can render it from a server component as long as you don't pass functions as props.

**Resources**

- Markdown: [/docs/components/timeline.md](https://shadcnuikit.com/docs/components/timeline.md)
- Variants: [Timeline components](https://shadcnuikit.com/components/timeline), 6 free examples
- Install: `npx shadcn@latest add @shadcnuikit/timeline1`
- MCP: call `get_item_code` with `timeline1` from the [MCP Server](https://shadcnuikit.com/docs/mcp-server)
- Full index for agents: [llms.txt](https://shadcnuikit.com/llms.txt)

Source: https://shadcnuikit.com/docs/components/timeline
More from Shadcn UI Kit: [llms.txt](https://shadcnuikit.com/llms.txt)