---
title: "Timeline Scrubber"
description: "Shows activity over a day as bars with a playhead. Drag back in time, replay the day, pause, and go back to live."
url: https://gelatinui.com/components/timeline-scrubber
markdown_url: https://gelatinui.com/components/timeline-scrubber.md
access: pro
install: "npx shadcn@latest add @gelatin-ui-pro/timeline-scrubber"
version: "2026-11-10"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Timeline Scrubber

> Shows activity over a day as bars with a playhead. Drag back in time, replay the day, pause, and go back to live.

Page: https://gelatinui.com/components/timeline-scrubber

## When to use it

Best for: A live span of activity that people scrub back in time, replay, pause, and send back to live.

- Use it for activity that grows in real time: traffic, events, requests.
- Use `onValueChange` to show what happened at the head, such as a count or an event.
- Use `defaultMode="paused"` with `defaultValue` to open on a time in the past.

## When not to use it

- To pick a value or a range with no time, use a [Slider](https://gelatinui.com/components/slider.md).
- To scrub frames of a video or an image sequence, use a [Scrub Slider](https://gelatinui.com/components/scrub-slider.md).

## Notes for agents

- `start`, `end`, `now`, and the head are epoch milliseconds.
- `counts` is one number per bucket, evenly from `start` to `end`. Buckets after `now` are not drawn.
- Leave out `now` and the part reads the real clock once a second; pass `now` from your app clock to keep it in step.
- The head is not controlled: start it with `defaultMode` and `defaultValue`, and read it with `onValueChange`.
- `onValueChange` runs in each replay frame and each live second: keep its work small.
- Compose `TimelineScrubberControls` and `TimelineScrubberTrack` to change the layout; a track with no children shows a `TimelineScrubberAxis`.
- Time runs left to right on every page; only the button row follows the page direction.

## Anatomy

```text
TimelineScrubber
├─ TimelineScrubberControls (0..n)
├─ TimelineScrubberReplay (0..n)
├─ TimelineScrubberPlay (0..n)
├─ TimelineScrubberLive (0..n)
├─ TimelineScrubberClock (0..n)
├─ TimelineScrubberTrack (0..n)
└─ TimelineScrubberAxis (0..n)
```

## API reference

### TimelineScrubber

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `aria-label` | `string` |  | Defines a string value that labels the current element. The accessible name of the group and the playhead. Default "Time". |
| `start` | `number` |  | The start of the span (ms since 1970). |
| `end` | `number` |  | The end of the span (ms). The future after `now` is a dashed line. |
| `now` | `number` |  | Now (ms), from the app clock. Leave it out and the part reads `Date.now` once a second. |
| `counts` | `readonly number[]` |  | One count per bucket, evenly from `start` to `end`; buckets after now are not drawn. |
| `defaultMode` | `"live" \| "paused"` | "live" | `paused` starts on `defaultValue`; `live` (default) starts on now. |
| `defaultValue` | `number` |  | The first head time with `defaultMode="paused"`. |
| `replayDuration` | `number` | 12_000 | How long a replay from start to now takes, in ms. Default 12,000. |
| `step` | `number` |  | The arrow key step in ms. Default: one bucket. |
| `largeStep` | `number` | 60 * 60 * 1000 | The Page key step in ms. Default: one hour. |
| `timeZone` | `string` |  | The IANA time zone of the clock and the axis. Default: the browser zone. |
| `locale` | `LocalesArgument` |  |  |
| `size` | `"default" \| "lg" \| "sm"` | "default" | The bar area height: `sm` 32, `default` 48, `lg` 64px. |
| `disabled` | `boolean` | false |  |
| `labels` | `Partial<TimelineScrubberLabels>` |  | The words of the Play button (`TIMELINE_SCRUBBER_LABELS`), to translate them. Keep the object stable. |
| `onModeChange` | `function` |  |  |
| `onValueChange` | `function` |  | The head time, on each change (a drag, a key, each replay frame, each live second). |

### TimelineScrubberControls

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TimelineScrubberReplay

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | "Replay" | The label. Default "Replay". It hides under 384px and stays the name. |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### TimelineScrubberPlay

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### TimelineScrubberLive

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` | "Go live" | The label while not live. Default "Go live". |
| `className` | `string` |  |  |
| `busy` | `boolean` |  | The button waits for the app (busy words): a spinner, `aria-busy`, and no clicks. Focus stays on the button. The style hook stays `data-loading`. |
| `spinnerPlacement` | `"center" \| "start"` |  | `center` (default): the spinner covers the label. `start`: it takes the leading icon slot. The icon sizes always use `center`, because their one icon is the label. |
| `glass` | `"clear" \| "dark" \| "light"` |  |  |
| `rounded` | `"default" \| "full"` |  |  |
| `size` | `"default" \| "icon" \| "icon-lg" \| "icon-sm" \| "icon-xs" \| "lg" \| "sm" \| "xl" \| "xs"` |  |  |
| `variant` | `"dashed" \| "default" \| "destructive" \| "destructive-outline" \| "ghost" \| "link" \| "media" \| "outline" \| "secondary"` |  |  |
| `liveLabel` | `ReactNode` | "Live" | The label while live. Default "Live". |

Also takes every prop of Base UI `Button`: https://base-ui.com/react/components/button

### TimelineScrubberClock

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TimelineScrubberTrack

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `children` | `ReactNode` |  | What goes under the bars. Default: a `TimelineScrubberAxis`. Pass `null` for none. |
| `label` | `string` |  | The accessible name of the playhead. Default: the root `aria-label`. |
| `getValueText` | `function` | timelineValueText | The value text of the playhead from the time ("09:07 UTC") and the count of its bar. Default: "09:07 UTC, 214 in this bar". Name what is counted: "09:07 UTC, 214 visitors". |

### TimelineScrubberAxis

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `ticks` | `number` | 5 | How many ticks, start and end included. Default 5 (every 6 hours of a day). |

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| TimelineScrubber | `timeline-scrubber` |  |  |  |
| TimelineScrubberControls | `timeline-scrubber-controls` |  |  |  |
| TimelineScrubberReplay | `timeline-scrubber-replay` |  |  |  |
| TimelineScrubberPlay | `timeline-scrubber-play` |  |  |  |
| TimelineScrubberLive | `timeline-scrubber-live` | `data-live` |  | `motion-timing`, `status-colors` |
| TimelineScrubberClock | `timeline-scrubber-clock` | `data-disabled` |  |  |
| TimelineScrubberTrack | `timeline-scrubber-track` | `data-disabled` |  |  |
| TimelineScrubberAxis | `timeline-scrubber-axis` |  |  |  |

## Usage

Pass the span and one count for each bucket. Put the axis in the track and the playback buttons in the controls.

```tsx title="visitors-today.tsx"
import {
  TimelineScrubber,
  TimelineScrubberAxis,
  TimelineScrubberClock,
  TimelineScrubberControls,
  TimelineScrubberLive,
  TimelineScrubberPlay,
  TimelineScrubberReplay,
  TimelineScrubberTrack,
} from "@/components/ui/pro/timeline-scrubber";

const HOUR = 60 * 60 * 1000;

/** Times are epoch milliseconds. `counts` has one visitor count for each bucket. */
export function VisitorsToday({ start, counts }: { start: number; counts: readonly number[] }) {
  return (
    <TimelineScrubber
      start={start}
      end={start + 24 * HOUR}
      counts={counts}
      aria-label="Time of day"
    >
      <TimelineScrubberTrack>
        <TimelineScrubberAxis ticks={9} />
      </TimelineScrubberTrack>
      <TimelineScrubberControls>
        <TimelineScrubberClock />
        <TimelineScrubberReplay />
        <TimelineScrubberPlay />
        <TimelineScrubberLive liveLabel="Now">Back to now</TimelineScrubberLive>
      </TimelineScrubberControls>
    </TimelineScrubber>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui-pro/timeline-scrubber
```

It adds 37 registry items: 33 files, 6137 lines, and the npm packages `@base-ui/react`, `@phosphor-icons/react`, `@xstate/react`, `clsx`, `motion`, `tailwind-merge`, `tailwind-variants`, `xstate`.

## Built on

- [Button](https://gelatinui.com/components/button.md)
- [Slider](https://gelatinui.com/components/slider.md)

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Slider](https://gelatinui.com/components/slider.md)
- [Button](https://gelatinui.com/components/button.md)
- [Ruler Slider](https://gelatinui.com/components/ruler-slider.md)
- [Scrub Slider](https://gelatinui.com/components/scrub-slider.md)

## Keyboard

| Keys | Action |
| --- | --- |
| Arrow keys | Moves the head by one bucket, or by `step`. |
| Page Up, Page Down | Moves the head by `largeStep` (one hour by default). |
| Home, End | Moves the head to the start or to now. |
| Space | Plays or pauses, while the head has focus. |

## Accessibility

The head is a native range input with a name from `aria-label`; its value text says the time and the count of its bar.

The Replay button keeps its name when its label hides on a narrow track.

The Play button says what a press does: Play or Pause. Translate it with `labels`.

## Motion

| Part | Motion |
| --- | --- |
| Go live | indicator · the head glides to now |
| Live dot | statusPop · the dot pops once when the part goes live |
| Time tag | fade · the time over the head fades in while you scrub or point at it |
| New data | panel · each bar grows from its old height |
