Audio
Voice Recorder
NewA record button whose rings breathe with your voice, a live level meter shedding sparks, and playback of the take before you send or discard it.
npx motionsnack add voice-recorderCustomize
<VoiceRecorder />Props
17 properties
| Property | Type | Default | Description |
|---|---|---|---|
| onSubmit | (take: { blob: Blob | null; duration: number }) => void | - | Called with the take when it is sent; blob is null for a simulated take. |
| onSend | (take) => void | - | Deprecated alias of onSubmit. |
| onDiscard | () => void | - | Called when a take is thrown away. |
| recordLabel / stopLabel / sendLabel / discardLabel | string | 'Start recording' / 'Stop recording' / 'Send voice message' / 'Discard recording' | Accessible names of the buttons. |
| playLabel / pauseLabel | string | 'Play recording' / 'Pause recording' | Accessible names of the take's play button. |
| labels | { recorder?, started?, stopped?, micDenied?, tryAgain?, seek?, position? } | English | Other UI strings and announcements; {time}, {total} are filled in. |
| locale | string | 'en-US' | BCP 47 locale of the spoken times. |
| particleCount | number | - | Deprecated, ignored. |
| meterBars | number | - | Deprecated, ignored. |
| bars | number | - | Deprecated, ignored. |
| className | string | '' | Extra classes on the card. |
| useMicrophone | boolean | false | Record from the real microphone. Off simulates a voice, so it can be tried anywhere. |
| maxDuration | number | 120 | Recording stops on its own at this length. |
| idleLabel | string | 'Tap to record a voice message' | Text shown before recording. |
| sentLabel | string | 'Voice message sent' | Text shown after sending. |
| glowColor | string | '#0044ff' | Colour of the ambient glow and the far particles (decorative light). |
| glowColorTo | string | '#9cc2ff' | Colour of the sparks and the near particles (decorative light). |
About Voice Recorder
Voice Recorder turns recording a message into something you want to watch. One white button does it all: it records, stops, sends and confirms, its icon turning into the next one each time. While you speak, two rings breathe out of it with the loudness of your voice, a ring around it fills towards the longest allowed take and particles drift up faster. Next to it the time rolls digit by digit and a live meter adds a bar for every moment, sparks rising from the newest one. When you stop, the take appears as a waveform you can play and drag through, with a bin to throw it away and the button turned into send. It can record from the real microphone, or simulate a voice so it works in any demo, and hands the recorded audio to your code when it is sent.
What's included
- One button that records, stops, sends and confirms
- Rings that breathe with the loudness of your voice
- Live level meter with sparks and a rolling timer
- Ring that fills towards the longest take
- Playback and scrubbing of the take before sending
- Discard and send, with the take handed to your code
- Real microphone or simulated voice, keyboard ready
- Type
- Animated React audio component
- Library
- Components · Audio
- Stack
- Next.js, React, Tailwind CSS
- Added