Timeline

A vertical run of events sharing one rail — deploys, incidents, review activity, an agent run. The connector stops at the last item instead of dangling past it.

src/components/ui/timeline.tsx

About

From the component's own source, where it was written.

A vertical run of events sharing one rail.

The connector is drawn by each item rather than by the container, as a line that stops at the last one (last:before:hidden). A single line behind the whole list is easier to write and wrong at both ends: it overshoots the final marker and starts above the first.

An ordered list, because a timeline is one — sequence is the meaning, and a screen reader should announce the count and position.

Install

npx astralyx-ui add timeline

Usage

import { Timeline, TimelineItem } from '@/components/ui/timeline'

<Timeline>
  <TimelineItem title="Deployed to production" time="2m ago" tone="success" />
  <TimelineItem title="Checks passed" time="6m ago" tone="info" />
</Timeline>

Composer

Change the props and the source below follows.

  1. Deployed to production
    2m ago
    Release 1.4.2
  2. Checks passed
    6m ago
  3. Commit pushed
    8m ago
  4. Awaiting review
    —
Props
tsx
<Timeline>
  <TimelineItem title="Deployed to production" time="2m ago" tone="success" icon={<Rocket />} />
  <TimelineItem title="Checks passed" time="6m ago" tone="info" />
  <TimelineItem title="Awaiting review" tone="muted" pending />
</Timeline>

Examples

Deploy history

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

Timeline

A vertical run of events sharing one rail.

Extends ComponentProps<'ol'>.

TimelineItem

Extends ComponentProps<'li'>.

PropTypeDefaultDescription
titlestringrequiredThe event. Required — an item with only a body has nothing to scan.
iconReactNode—Replaces the default dot.
timeReactNode—Right-aligned from sm up, and under the title on narrow screens.
tone'default' | 'success' | 'warning' | 'danger' | 'info' | 'muted''default'Marker colour.
pendingbooleanfalseDraw the marker as an outline, for an event that has not happened yet.

TimelineContent

A framed body under an event — a log excerpt, a diff, a message.

Extends ComponentProps<'div'>.