Find the passage
Select a region or move the playhead.
Displays supplied audio amplitudes with optional seeking and editable selection bounds.
Select a region or move the playhead.
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { Waveform } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/waveform.
npx @noorddev/vlak-cli add waveform
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/waveform.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { Waveform } from "@noorddev/vlak-react";
<Waveform samples={[0.2, 0.5, 0.8, 0.3, 0.7, 0.4]} label="Interview waveform" value={position} onValueChange={setPosition} region={region} onRegionChange={setRegion} />A waveform from supplied amplitude data, optionally scrubbed through a native range.
| Prop | Type | Default | Description |
|---|---|---|---|
samplesrequired | readonly number[] | Amplitudes from zero to one; values are clamped. | |
labelrequired | string | ||
value | number | ||
defaultValue | number | 0 | |
onValueChange | (position: number) => void | ||
disabled | boolean | false | |
region | WaveformRegion | ||
defaultRegion | WaveformRegion | { start: 0, end: 1 } | |
onRegionChange | (region: WaveformRegion) => void |
Also accepts Omit<HTMLAttributes<HTMLDivElement>, "defaultValue">.
| Keys | Does |
|---|---|
| Tab, Arrow keys, Home, End | Operates the native seek range and optional selection start and end ranges. |
<div class="rs-waveform"><svg class="rs-waveform-plot" viewBox="0 0 80 48" role="img" aria-label="Audio waveform"><path d="M0 24 H10 V10 H12 V38 H14 V24 H30 V4 H32 V44 H34 V24 H80" fill="none" stroke="currentColor" /></svg></div>