Skip to content
pandacoderz/ui

Waveform

Audio-style bar visualizer for voice input and text-to-speech playback, animated in CSS.

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/waveform.json

Usage

import { Waveform } from "@/components/pandacoderz-ui/waveform";
<Waveform active={isListening} bars={32} height={48} />

Pass levels to render real audio. Feed it from an AnalyserNode on each animation frame and the bars follow the microphone instead of the built-in animation.

const levels = React.useMemo(() => Array.from(frequencyData, (v) => v / 255), [frequencyData]);
<Waveform levels={levels} bars={levels.length} />

API Reference

Prop Type Description
bars number Number of bars. Default 24.
active boolean Animate. When false, bars flatten.
levels number[] 0–1 per bar; overrides the animation.
height number Height in px. Default 40.
duration number Base animation duration in seconds. Default 0.9.
color string Bar color. Defaults to currentColor.