Scrub bar

A React component in Beamline's Voice & audio category.

A seekable timeline for audio or video: elapsed and total time, what has loaded, chapter marks, a time preview under the pointer, and the full keyboard of a media slider.

Use it for

  • The position control of a custom audio or video player.
  • Seeking inside a recording with chapter or speaker marks.

Not for

  • Choosing a value on a scale (slider).
  • Showing how far a task has got (progress).

Anatomy

  • elapsed time
  • track (an inset well: the loaded run, the played run as a solid, chapter ticks)
  • thumb (the knob; shown under the pointer, on focus and while held)
  • playhead (instead of the thumb when the track is a waveform)
  • time preview (under the pointer; above the knob while the bar has keyboard focus, with the chapter)
  • total time

Variants

  • size: sm, md

States

  • idle
  • hover (track thickens, preview time)
  • scrubbing (pointer held)
  • focused (keyboard: the knob shows and the time and chapter ride above it)
  • unknown length (hatched, not seekable)
  • disabled (the whole bar at the disabled opacity, no thumb)
  • narrow room (under 240 px: the rail takes the whole row and the times sit under its two ends)
  • buffering (playback waits for data: the rail breathes until it arrives; aria-busy)

Keyboard

  • ← / → seek by `step` (5 s; mirrored in RTL)
  • ↑ / ↓ the same
  • Page Up / Page Down seek a tenth of the length
  • Home / End go to the start / the end
  • Space or K play and pause (with onTogglePlay)

Motion

One position property drives the played run (scaleX), the knob, the playhead and the keyboard's label (translate), so following playback costs no layout. Each new position glides over --pui-duration-fast, linear: playback writes about thirty times a second, so each step is met rather than eased, and a key seek or a word clicked in a transcript travels there. While the pointer holds the bar everything follows it exactly. The knob grows on hover at 0 ms and settles back over --pui-motion-out; what has loaded grows in over --pui-duration-standard. Under reduced motion the position changes at once.

Props

PropTypeDefaultDescription
value / defaultValue / onValueChangenumber—value: Position in seconds. Controlled with onValueChange, or uncontrolled from defaultValue. defaultValue: Initial playback position in seconds when uncontrolled. Defaults to 0. onValueChange: Every change, including each move while scrubbing.
onValueCommit(seconds: number) => void—When a seek is settled (pointer released, a key pressed): seek the media here.
duration (required)number | null—Length in seconds; null while unknown, which hatches the track and makes it inert.
bufferednumber—Seconds loaded from the start.
bufferingboolean—Playback is waiting for data: the rail breathes until it arrives (and the slider says it is busy).
markers{ time: number; label: string }[]—Chapter or speaker marks; their label shows in the pointer preview.
stepnumber5Seconds per arrow key. Default 5.
format(seconds: number) => stringm:ssFormats a raw numeric value for display. Defaults to minutes and seconds.
showTimebooleantrueElapsed and total time at the ends. Default true.
onTogglePlay() => void—Space and K on the bar call this (play or pause).
onScrubbingChange(scrubbing: boolean) => void—Reports scrubbing state after a change; no callback by default.
labelstring"Seek"Accessible name. Default "Seek".
size"sm" | "md""md"Control size within the supported size steps. Defaults to "md".
disabledboolean—Prevents interaction with the control. Defaults to false.
classNamesScrubBarClassNames—Classes for the named visual parts; no part overrides by default.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
valuenumber—Position in seconds. Controlled with onValueChange, or uncontrolled from defaultValue.
defaultValuenumber—Initial playback position in seconds when uncontrolled. Defaults to 0.
onValueChange((seconds: number) => void)—Every change, including each move while scrubbing.
peaksreadonly (number | null)[]—Draw the track as the recording's waveform (loudness 0–1 per slice, null where unmeasured).
classNamestring—Classes on the documented visual root; no override by default.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
stopsreadonly number[]—Positions the arrows step between instead of `step` (the events of a replay: each step's start and end), in seconds.

Built from

Used in

Import

import { ScrubBar } from "@beamline/scrub-bar";

Get it

Scrub bar is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Get Beamline · Connect your agent

More in Voice & audio

  • Recorded answer: A spoken answer against a time limit: record (the microphone asked for first, a blocked one said with what to do), the running time against the limit…
  • Orb: The agent's presence: a thin ring of light around a lens in the brand's hue that holds still at rest, sends an arc round while thinking and widens with…
  • Call grid: The people on a video call, laid out for the room they are given: tiles as large as the space allows at the camera's shape, or the person talking (or a…
  • Bar visualizer: A row of bars that says what a voice agent is doing: a sweep while connecting, the person's voice while listening, a slow breath while thinking, the…
  • Matrix: A dot-matrix display: animated frame sets (loading, pulse, wave, syncing), text and digits in a 5×7 font, or a VU meter of levels or a live source. One…
  • Transcript viewer: A recording and its words together: the spoken word lights up as it plays and the transcript follows it, any word or paragraph time plays from there…
  • Waveform: The shape of a recording: one bar per slice of loudness, fitted to any width, with the played part in the accent, unmeasured slices hatched and a loading…
  • Live waveform: Loudness drawn as it happens: a scrolling history of the microphone (or any live source) or its spectrum, a calm processing state while words are…
  • Conversation bar: The control bar of a voice call with an agent: one button to call and hang up, the agent's state as bars, a call timer, mute, and typing when talking is…
  • Audio player: One audio element and its controls: play with a loading state, a scrub bar with time, skip, speed and a playlist whose rows play into the same player…
  • Voice button: The control that starts and stops talking: click to toggle or hold to talk (pointer, Space, Enter or a global shortcut), with a live level while…
  • Speech input: A text field you can speak into: the mic dictates through any speech-to-text provider, the phrase being heard shows apart from the finished words, and…
  • Voice picker: Choose a text-to-speech voice from a searchable list (name, accent, tone, use) and hear it first: each voice has its own orb, previews play one at a time…
  • Microphone selector: Choose the microphone, test it with a live level and mute it, with every permission and device state spelled out: not yet allowed, blocked (and how to…

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.