Canvas-based real-time waveform visualizer with processing animation, microphone input, and stop controls.
Install
Add it to your project
Run this in a project set up for shadcn/ui. It writes the files and installs the npm packages.
First time: connect the Infinity UI registry
- Create a personal token on your Tokens page.
- Put it in
.env.localasINFINITYUI_TOKEN. - Add the registry to
components.json:
{
"registries": {
"@infinityui": {
"url": "https://infinityui.io/r/{name}.json",
"headers": {
"Authorization": "Bearer ${INFINITYUI_TOKEN}"
}
}
}
}Using Claude Code, Codex, Cursor, Lovable or v0? See CLI & MCP for a setup prompt.
npm packages it adds
- lucide-react
Code
"use client";
import { useState } from "react";
import LiveWaveform from "@/registry/ruixenui/live-waveform";
const states = ["idle", "processing", "active"] as const;
type State = (typeof states)[number];
const labels: Record<State, string> = {
idle: "Idle",
processing: "Processing",
active: "Listening",
};
export default function LiveWaveformDemo() {
const [state, setState] = useState<State>("processing");
return (
<div className="flex min-h-[350px] w-full items-center justify-center p-8">
<div className="w-full max-w-2xl space-y-4">
<LiveWaveform
processing={state === "processing"}
active={state === "active"}
onStop={() => setState("idle")}
/>
<div className="flex items-center justify-center gap-2">
{states.map((s) => (
<button
key={s}
onClick={() => setState(s)}
className={`rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${
state === s
? "bg-foreground text-background"
: "bg-muted text-muted-foreground hover:text-foreground"
}`}
>
{labels[s]}
</button>
))}
</div>
</div>
</div>
);
}
































