Xzero UI
Pro library

Line replayPro

A time replay line chart that draws a day of traffic with a moving playhead, a value label on the tip, a scrubber, speed control and key moments annotated as the playhead passes them.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/line-replay
Live · keyboard ready

Render <LineReplay /> for the launch day demo, or pass data (points with time in minutes, value and optional baseline) and moments on the same clock. Use onMomentReached to react as playback passes each moment, and defaultPosition, duration and defaultSpeed to tune how it opens and plays.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/line-replay

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { LineReplay, type ReplayMoment, type ReplayPoint } from "@/components/xzero/blocks/line-replay/line-replay";

export function IncidentReplay({ points, moments }: { points: ReplayPoint[]; moments: ReplayMoment[] }) {
  return (
    <LineReplay
      title="Checkout errors, 14 May"
      description="Failed payments per minute across the incident window, UTC."
      data={points}
      moments={moments}
      seriesLabel="14 May"
      baselineLabel="Previous Tuesday"
      valueLabel="Errors"
      duration={20}
      onMomentReached={moment => analytics.track("replay_moment", { id: moment.id })}
    />
  );
}

API reference

LineReplay

A time replay line chart. Press play and the line draws through the day with a playhead, a value label riding the tip and a clock on the time axis. Key moments are annotated as the playhead passes them: a marker settles onto the line, a callout rises in a lane above the plot, and the matching row in the moments list lights up and reveals its effect once that window has played. A scrubber with moment ticks, a speed control and a live readout (time, value, ratio to a comparison line and the peak so far) sit around the chart.

PropTypeDefaultDescription
dataReplayPoint[]POINTSPoints in time order: time in minutes from the start, the replayed value, and an optional baseline drawn in full as a quiet dashed comparison. Leave baseline out of every point to hide the comparison, its legend entry and the ratio readout.
momentsReplayMoment[]MOMENTSKey moments on the same clock: id, time, title, an optional one-line detail and a kind (launch, press, email, incident or milestone) that picks the icon. Incidents are drawn in the warning color and their effect is the dip over 20 minutes; every other moment reports the rise over the next hour.
titlestring"Launch day"Heading of the block.
descriptionstring"People on site every five minutes on Tuesday 8 September 2026, Pacific time."One line under the heading that names what is measured and when.
seriesLabelstring"Launch day"Legend name of the replayed line.
baselineLabelstring"Typical Tuesday"Legend name of the comparison line, also used in the ratio readout ("Versus typical Tuesday").
valueLabelstring"On site"Label of the value under the playhead, in the readout and the scrubber's value text.
formatTime(minutes: number) => stringformatClockFormats a time on the replay clock for the readout, the playhead clock, callouts and the moments list. The default prints 9:40 am.
formatTick(minutes: number) => stringformatHourFormats the time axis labels. The default prints 6 am.
formatValue(value: number) => stringformatCountFormats values in the readout, the tip label and moment effects.
durationnumber16Seconds a full replay takes at 1×.
defaultSpeed0.5 | 1 | 2 | 41Starting playback speed.
defaultPosition"start" | "end""end"Where the playhead rests before the first play. "end" shows the whole line with every moment; pressing Replay rewinds and plays from the start.
autoPlaybooleanfalsePlays from the start the first time the block is 40% in view. Ignored with reduced motion.
onMomentReached(moment: ReplayMoment) => void–Called when playback passes a moment (not when scrubbing or jumping).
classNamestring–Class on the root element.

Keyboard interactions

KeysAction
TabMoves through the play button, the scrubber, the speed control and each key moment.
Space / Enter / KOn the scrubber, plays or pauses the replay. At the end it replays from the start.
Arrow left / Arrow rightOn the scrubber, steps one point (five minutes in the sample). Hold Shift to step an hour.
Page up / Page downOn the scrubber, steps an hour.
Home / EndOn the scrubber, jumps to the start or the end.
Arrow keysOn the speed control, moves between 0.5×, 1×, 2× and 4×.
Enter / SpaceOn a key moment, moves the playhead to it; playback continues from there if it was playing.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components