Xzero UI
Pro library

Voice recorderPro

Record with a live waveform, review and scrub, then send the take into the thread.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui-pro/voice-recorder
Live · keyboard ready

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui-pro/voice-recorder

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { VoiceRecorder, voicePeaks } from "@/components/xzero/voice-recorder/voice-recorder";

const history = [
  { id: "m1", duration: 7, peaks: voicePeaks(1, 7), from: "Sam", avatar: "/people/sam.jpg", meta: "9:41 AM" },
];

export function Thread() {
  return <VoiceRecorder defaultMessages={history} maxDuration={30} onSend={message => console.log("sent", message.id)} />;
}

API reference

VoiceRecorder

A voice note composer and thread. Tap the mic to record into a live bar with a scrolling waveform and timer, stop into a review you can play and scrub, then send the take into the thread as a voice bubble.

PropTypeDefaultDescription
defaultMessages{ id: string; duration: number; peaks: number[]; from?: string; avatar?: string; meta?: string }[][]Messages already in the thread, oldest first. peaks are bar heights from 0 to 1 (the exported voicePeaks makes deterministic data); from and avatar mark incoming messages.
onSend(message: VoiceMessage) => void–Called with each sent take. Recording is simulated, so wire this to real audio capture.
onCancel() => void–Called when a take is discarded with the trash button or Escape.
maxDurationnumber60Seconds before recording stops on its own and moves to review.
sentMetastring"Just now"Meta line under messages you send.
labelstring"Voice messages"Accessible name of the whole recorder.
classNamestring–Class on the root section.

Keyboard interactions

KeysAction
Enter / SpaceActivate the focused control: record, stop, send, play, or discard. Focus follows from mic to stop to send and back.
EscapeDiscard the take while recording or reviewing.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Also in audio and video

Guidance for AI tools

Voice recorder: Record with a live waveform, review and scrub, then send the take into the thread. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components