Componentmedia1.13 KB gzipZero dependencies
Audio Recorder
Microphone recording simulator with waveform and send action.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add audio-recorderOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { AudioRecorder } from "@/components/ui/audio-recorder"; <AudioRecorder />Source code
audio-recorder.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxaudio-recorder.tsx72 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface AudioRecorderProps extends React.HTMLAttributes<HTMLDivElement> { onSend?: (seconds: number) => void;} /** Audio recorder simulator: waveform + duration + send. */export function AudioRecorder({ onSend, className, ...props }: AudioRecorderProps) { const [recording, setRecording] = React.useState(false); const [seconds, setSeconds] = React.useState(0); React.useEffect(() => { if (!recording) return; const t = setInterval(() => setSeconds((s) => s + 1), 1000); return () => clearInterval(t);Props
| Prop | Type | Description |
|---|---|---|
| onSend | (seconds: number) => void | Callback invoked on send. |