Timeline

The Timeline component is used to display items on a vertical Timeline, connected by Timeline elements.

Page navigation navigation

React examples

GitHub's rollout of primer_react_timeline_list_semantics is generally available (GA), but the Primer React package still defaults this flag to false. Enable it with FeatureFlags from @primer/react/experimental to render Timeline as an ordered list and Timeline.Item as a list item.

Each example includes its own provider, so the preview, full code, and StackBlitz export all enable list semantics without relying on the documentation site's configuration. Keep Timeline.Item and Timeline.Break as direct children of Timeline, without intervening DOM wrappers. See the accessibility requirements.

Default

  1. This is a message
  2. This is a message
  3. This is a message

Clipped sidebar

  1. This is a message
  2. This is a message
  3. This is a message

Condensed items

  1. This is a message
  2. This is a message
  3. This is a message

With a break

Timeline breaks

Timeline.Break visually separates content. With list semantics enabled, it renders an empty <li role="presentation">, not an event in the accessible list. Use it only for decoration, without meaningful text or interactive content.

The content within Timeline.Item must communicate each item's status and the reason for any separation without relying on the break.

  1. This is a message
  2. This is a message
  3. This is a message

Use RelativeTime for a plain timestamp, or compose it with Link to make an event permalink. Use fgColor-muted for both forms and keep the timestamp link underlined so color alone does not identify it as interactive.

Let the host application supply the user's relative or absolute time preference. On GitHub, the accessibility setting controls this preference. The underlying relative-time element reads data-prefers-absolute-time="true" on <html> or <body>; an attribute on a wrapper does not set the preference. Neither RelativeTime nor this example fetches a GitHub account setting. This example leaves the format unset and lets the existing formatter honor the host setting.

The first event shows a non-link timestamp and its precise date and time as visible text. This keeps the exact time available without making static text focusable or relying on a tooltip. The second event makes its timestamp a permalink and uses an accessible Tooltip to expose the precise localized date and time on hover and keyboard focus. Its description supplements rather than replaces the link text.

Both forms use noTitle to remove the native tooltip. The precise-time text starts with an exact UTC value and uses the document language after client hydration, falling back to the platform locale if the document language is absent or empty. Neither form adds a format-selection control. Follow the RelativeTime accessibility guidance for other timestamp contexts.

Use persistent event IDs, unique on the page, for the target id and link href. Do not derive permalink IDs from array positions or generate them during render. The example uses fixed event records and restores the initial fragment after it mounts. Native fragment links handle later scrolling. Opening or reloading a bookmarked URL reveals the event and highlights its badge, without making the row or badge focusable. Keyboard focus indicators belong to interactive elements, such as the timestamp link, not to the target highlight.

This recipe adds scrolling and badge styling through public composition; these are not built-in Timeline behaviors. GitHub's issue timeline also keeps target highlighting separate from focus: its scroll handler reveals the event without focusing the row, and its event badge uses accent-colored rings. These implementation references require GitHub staff access.

The example clears the highlight on clicks elsewhere and restores it on permalink activation, including repeated activation of the current target, or when the fragment changes. Initial restoration does not scroll away from an active editor when the live example remounts. Applications must load an on-demand target and account for their own sticky headers before revealing it. This small recipe does not reproduce GitHub's routing, loading, or sticky-header handling.

  1. Mona added the first commit
    Oct 20, 2026
    Exact time:
  2. Mona updated the documentation
    Oct 20, 2026 (permalink to Mona updated the documentation)

Props

Timeline

NameDefaultDescription
clipSidebar
| boolean | 'start' | 'end' | 'both'

Controls which ends of the sidebar are clipped. When set to true or 'both', hides the sidebar above the first and below the last Timeline.Item. Use 'start' to only clip the top or 'end' to only clip the bottom.

Timeline.Item

NameDefaultDescription
condensed
boolean

Reduces vertical padding and removes background from an item's badge.

Timeline.Badge

NameDefaultDescription
variant
'accent' | 'success' | 'attention' | 'severe' | 'danger' | 'done' | 'open' | 'closed' | 'sponsors'

The color variant of the badge.

Timeline.Body

No props documented

Timeline.Break

No props documented

Timeline.Actions

No props documented

Timeline.Avatar

No props documented