Code

<!-- voice-wave.free.js: download it from the Install section below and host it with your site -->
<script src="/voice-wave.free.js" defer></script>

<voice-wave
  state="speaking"
  level="0.7"
  bars="28"
  size="64"
  surface="porcelain"
  theme="light"
></voice-wave>

<script>
  // feed it your own loudness, 0..1
  const wave = document.querySelector('voice-wave');
  recogniser.onlevel = (v) => wave.setAttribute('level', v);
</script>

In context

Idle
Dictation bar, Aurora
Click the capsule to use your microphone.
Glass ribbon with your microphone, Mint Pro

Install · Free Web Component

One file, no dependencies. Aurora preset, every other option included. Host it yourself so your visitors never load anything from our servers.

1. Install with one command — or download the file
shadcn CLI · React
npx shadcn@latest add https://www.ui-design.co/r/voice-wave.json
2. Load it and use the element
HTML
<!-- voice-wave.free.js: download it from the Install section below and host it with your site -->
<script src="/voice-wave.free.js" defer></script>

<voice-wave
  state="listening"
  level="0.6"
  bars="24"
  size="56"
  surface="porcelain"
  theme="light"
></voice-wave>

<script>
  // feed it your own loudness, 0..1
  const wave = document.querySelector('voice-wave');
  recogniser.onlevel = (v) => wave.setAttribute('level', v);
</script>
3. React + TypeScript (optional)

The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:

TypeScript
// voice-wave.d.ts
declare namespace JSX {
  interface IntrinsicElements {
    'voice-wave': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
      state?: 'idle' | 'listening' | 'thinking' | 'speaking';
      level?: number | string;
      bars?: number | string;
      size?: number | string;
      surface?: 'porcelain' | 'glass';
      theme?: 'light' | 'dark';
      label?: string;
      speed?: number | string;
    };
  }
}

Pro · React + TypeScript Pro

One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.

  • React component with TypeScript types and the full source
  • Ribbon variant: one continuous band of light instead of bars
  • Live audio: mic for the microphone, attach() for your speech output or any audio node
  • Sunset, Mint and Mono tints, plus custom three-colour tints
  • The vanilla Web Component with everything above, a demo page, README and license

Attributes & props

NameTypeDefaultDescription
state 'idle' | 'listening' | 'thinking' | 'speaking''idle'Idle is a slow travelling breath; listening rises from the middle; thinking sweeps a scanner across the row; speaking is the full wave. States blend, they never cut.
level 0..1built-in patternLoudness for listening and speaking. Leave it out and the wave moves in a speech-like pattern of its own.
bars 5..6424How many bars. The capsule grows with the count unless you give it a CSS width, in which case the bars spread to fit.
size number (px)56Height of the capsule; everything inside scales with it.
surface 'porcelain' | 'glass''porcelain'Porcelain for plain pages; glass blurs whatever is behind it, so give it a photo or a gradient.
theme 'light' | 'dark''light'Capsule, well and bar colours for light or dark pages.
label string'Voice activity'Accessible name; the current state is appended for screen readers.
speed number1Speed of the built-in motion. 0 freezes it.
variant Pro'bars' | 'ribbon''bars'Ribbon draws the same springs as three twisting bands of light. Free build draws bars.
tint Pro'aurora' | 'sunset' | 'mint' | 'mono''aurora'Colours of the wave and of the light it throws under the capsule. Free build ships Aurora only.
mic ProbooleanoffMakes the capsule a button: a click opens the microphone and the bars follow the voice band of your input; another click closes it. Nothing is requested on load. Fires micchange (detail.on) and micerror.
attach(source) PromethodFollow a live source instead of level: an AnalyserNode, any AudioNode (your speech output) or a MediaStream. detach() lets go; startMic() / stopMic() do what the click does.

The bars are springs with two stiffnesses: stiff on the way up, soft on the way down, so a loud syllable lands at once and then drains away. That asymmetry is what makes it read as a voice rather than an equaliser. With live audio the middle bars take the low voice frequencies and the edges the high ones. Without mic the capsule is a picture for assistive tech (role="img", with the state in its name); with it, a button with aria-pressed. It is drawn on a 2D canvas, pauses off-screen and in hidden tabs, and under reduced motion shows one still frame per state. Pair it with Plasma Orb: the same four states, the same tints.

More components