Skip to main content

RevisionTimeline

Data

The GIT-HISTORY rail; a generic ordered-steps rail is Core/Timeline — see [Choosing between similar components](?path=/docs/docs-choosing-between-similar-components--docs).

import { RevisionTimeline } from "@elabs-ai/components-ui";
Install
npm install @elabs-ai/components-tokens @elabs-ai/components-ui

Skipping the @source line is the most common first failure: Tailwind does not scan node_modules, so every component renders unstyled. The one-time wiring

Prompt for your coding agent

Paste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.

Add the brand-ui RevisionTimeline component (from @elabs-ai/components-ui) to this project.

1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`.
2. Look RevisionTimeline up before writing code: `npx -y @elabs-ai/components-cli docs RevisionTimeline` prints its real props, variants, what it pairs with and what to avoid.
3. If @elabs-ai/components-ui is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`.
4. Use it here: [the screen or file, and what it should show]
5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop.
6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.

Examples

9 live examples

Branch And Merge

Branch and merge — two lanes with a merge commit, showing SVG cross-lane bezier curves.

Selection

Selection — demonstrates controlled and uncontrolled selection with onSelect callback.

Compact

Compact density — tighter row height for dense information displays.

Controlled Selection

Controlled selection — parent manages the selected id externally.

Nested Branches

Collapsible branches — supply `branches` to fold a branch (and its nested descendants) into a single summary row at its tip. Click the chevron on the `feat/dark-mode` tip to collapse it; the nested `feat/dark-mode/tokens` commits fold in too, and the merge connector re-routes to the summary node.

Collapsed By Default

Collapsed by default — the branch starts folded; expanding restores its commits.

Controlled Collapse

Controlled collapse — the parent owns the collapsed-branch set.

Process Flow

Process flow — branches as collapsible, **deeply nested** categories. Opens fully folded into the top category ("Research phase · 8 steps"); each expand reveals that level's steps plus the next collapsed category, so you can drill four levels deep: Research phase ▸ Web search ▸ Fetch documents ▸ Rank results. A deliberate (useful) misuse of the branch model.

API

RevisionTimeline

density
comfortable (default)compact
PropTypeDescription
revisionsrequiredRevision[]Ordered revisions, newest → oldest.
edgesRevisionEdge[]Parent-link edges for drawing the branch graph. Each edge connects a child revision (`from`) to its parent (`to`).
groupBy"day" | "none"How to group revisions. `"day"` inserts day headers; `"none"` renders a flat list. @default "day"
formatDay(d: Date) => stringFormat the day-group header label. Defaults to `Intl.DateTimeFormat` long date.
selectedIdstringControlled selection: the id of the currently-selected revision. Omit to use uncontrolled selection (`defaultSelectedId`).
defaultSelectedIdstringInitial selected revision id for uncontrolled usage.
onSelect(id: string) => voidCalled when the user selects a revision row.
branchesRevisionBranch[]Collapsible branch registry. **Supplying this opts in to the collapse/expand mode.** Each listed branch becomes collapsible; a branch's commits fold into a single summary row at its tip. `parentBranchId` nests branches so collapsing a parent also folds its descendants (multi-level). A revision whose `branchId` is not listed here (e.g. the trunk) stays permanently visible. Omit entirely for the classic, non-collapsible timeline.
collapsedBranchIdsstring[]Controlled set of collapsed branch ids.
defaultCollapsedBranchIdsstring[]Uncontrolled initial set of collapsed branch ids.
onBranchToggle(branchId: string, collapsed: boolean) => voidCalled when a branch is collapsed or expanded. `collapsed` is the NEXT state.
formatBranchSummary(count: number, branch: RevisionBranch) => stringTrailing summary text on a collapsed branch row. Defaults to `"<n> commit(s)"`; override to re-vocabulary the timeline (e.g. `"<n> steps"` when modelling a process flow rather than git history).

Also accepts: Omit<HTMLAttributes<HTMLDivElement>, "onSelect">, VariantProps<typeof revisionTimelineVariants>