Shadcn Voice Note
A hold-to-record voice note component with dynamic audio waveform bars, slide-to-cancel gesture, and instant playback with a discard option.
Press and hold the pill to record audio in real time. Sliding left cancels the recording, and releasing gives you an instant audio player with waveform seeking and a close/discard option.
Voice Note
Press and hold to record with live animated waveforms, slide left to cancel, and release to preview audio playback with close option.
holdLabel"Hold to record"- label displayed inside the pill during the idle state.
slideCancelLabel"< Slide to cancel"- cancel hint shown underneath the pill during active recording.
Installation
New project? Follow the installation guide to set up Tailwind CSS, shadcn, the cn helper and lucide-react, register the @avara-ui registry once, then copy your styles from the Themes page.
Install Voice Note
components/ is written into your project. Copy any snippet from a Usage tab above and it runs.
Install dependencies
Nothing beyond the shared setup — Voice Note needs only the cn helper and lucide-react, which the installation guide already put in place.
Props Reference
| Prop | Type | Default | Description |
|---|---|---|---|
holdLabel | string | "Hold to record" | Label displayed inside the pill during the idle state. |
slideCancelLabel | string | "< Slide to cancel" | Subtext displayed underneath the pill during active recording. |
themeColor | string | undefined | Custom theme accent color applied to the play button, active soundwave bars, and pulse indicators. |
maxDuration | number | 60 | Maximum recording duration in seconds before auto-completing. |
minDuration | number | 0.5 | Minimum duration in seconds required to accept the recording. A short tap below this threshold cancels the record immediately. |
enableMic | boolean | true | Captures real audio via navigator.mediaDevices when microphone permission is granted. |
initialState | "idle" | "recording" | "recorded" | "idle" | Initial visual state for previews and testing. |
onRecordStart | () => void | undefined | Callback invoked when the user starts holding to record. |
onRecordComplete | (result: VoiceNoteRecordResult) => void | undefined | Callback invoked when recording successfully finishes. |
onCancel | () => void | undefined | Callback invoked when recording is cancelled or closed via the 'X' button. |