View as Markdown

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.

Order placed
We received your order.
Shipped
Your package is on the way.
Delivered

Installation

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. Timeline is free and installs without an API key.

Manual installation

Install the dependencies:

npm install @ui-sdk/react@beta

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

components/ui/timeline.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

import {
  Timeline,
  TimelineConnector,
  TimelineDescription,
  TimelineItem,
  TimelineMarker,
  TimelineTime,
  TimelineTitle,
} from "@/components/ui/timeline";
<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

<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.

Project created
First commit pushed
Preview deployed

Status

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

Complete
Current
Upcoming

Horizontal

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

Kickoff
Beta
Launch

Icon

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

Review requested
Changes approved
Ready to merge

Feed

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

Search is faster
Read the full release note.
Dark mode for emails
Read the full release note.

Controller

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

Draft
In review
Approved
Published

More layouts built with Timeline, such as order tracking, changelogs and repository activity, are on the Timeline components page.

API Reference

Timeline

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

PropTypeDefaultDescription
orientation"vertical", "horizontal""vertical"Which way the events run, which also picks the arrow keys that move between them.
loopbooleantrueWhether arrow keys wrap from the last event to the first.
feedbooleanfalseMakes the events a feed. Each event becomes an article with aria-posinset and aria-setsize.
busybooleanfalseSets aria-busy while a feed loads or changes events. Only a feed reads it.
controllerTimelineControllerFocuses an event from anywhere. Create one with createTimelineController().
renderReactElement, (props, state) => ReactNodeRenders your own element.
classNamestringClasses 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.

PropTypeDefaultDescription
status"complete", "current", "upcoming"Where the event stands in a process. current sets aria-current="step" and takes the tab stop first.
valuestringgeneratedNames the event for the controller's focus().
classNamestringClasses 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.

PropTypeDefaultDescription
classNamestringClasses 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.

PropTypeDefaultDescription
classNamestringClasses 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.

PropTypeDefaultDescription
classNamestringClasses for the title.

TimelineTime

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

PropTypeDefaultDescription
dateTimestringThe date or time in a machine readable format, like 2026-11-20.
classNamestringClasses for the time.

TimelineDescription

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

PropTypeDefaultDescription
classNamestringClasses for the description.

createTimelineController

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

KeyAction
TabMoves focus into the timeline, to the current event or the first one.
ArrowDown, ArrowUpMoves to the next or previous event in a vertical timeline.
ArrowRight, ArrowLeftMoves to the next or previous event in a horizontal timeline. Flips in right to left layouts.
Home, EndMoves to the first or last event.
PageDown, PageUpIn 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.
  • A plain list with no order in time. Use a normal list or a Table.
  • Chat messages. Use the 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