Waveform

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

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 state. Peaks can be decoded from the file in the browser.

Use it for

  • Showing a recording's shape in a list, a message or a player.
  • Playback progress over the shape (pass progress); to seek on it, use scrub-bar with peaks.

Not for

Anatomy

  • bars (resampled to the width)
  • played overlay (clipped, accent)
  • unmeasured slices (hatched stubs)

Variants

  • variant: mirror (centred), bars (from the baseline)
  • tone: accent, neutral

States

  • loading (skeleton bars; when the shape arrives the bars sweep in from the start, once)
  • empty (emptyLabel)
  • static
  • with progress
  • unmeasured slices

Keyboard

  • None: it is a picture (role img with a label). Seeking lives in scrub-bar.

Motion

Progress moves by clipping one overlay, so following playback repaints nothing else; each step eases in over --pui-duration-fast, linear, so a seek glides. The loading skeleton pulses only while loading, on screen and not under reduced motion; the shape arriving after it sweeps in over --pui-duration-sweep (a fade under reduced motion). Bars are resampled to the width (read before the first paint), never stretched.

Props

PropTypeDefaultDescription
peaks (required)(number | null)[]—Loudness 0–1 per slice, any count; resampled (by maximum) to the bars that fit. null: not measured.
progressnumber—Played fraction 0–1; the played part takes the tone colour.
variant"mirror" | "bars""mirror"Legacy shape setting; omitted by default. Deprecated: Use shape instead.
tone"accent" | "neutral""accent"Semantic colour of the displayed content. Defaults to "accent".
heightnumber40Height in px. Default 40.
barWidth / gapnumber2 / 2barWidth: Width of each waveform bar in pixels. Defaults to 2. gap: Gap between adjacent bars in pixels. Defaults to 2.
loadingboolean—Shows the loading state while data or an operation is pending. Defaults to false.
emptyLabelstring"No audio"Shown instead of an empty frame.
labelstring—Accessible name; the waveform is a picture of the recording.
classNamesWaveformClassNames—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.
shape"mirror" | "bars"—Centred mirror bars or bars rising from a baseline; defaults to mirror.
barWidthnumber—Width of each waveform bar in pixels. Defaults to 2.
gapnumber—Gap between adjacent bars in pixels. Defaults to 2.
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.

Used in

Import

import { Waveform } from "@beamline/waveform";

Get it

Waveform 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…
  • 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…
  • Scrub bar: 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…
  • 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.