---
title: "Voice Note"
description: "A mic button that opens into a recording bar with a timer, a live waveform, discard and send. The bar springs out of the mic's circle to both sides, folds back into it on send, and the app owns the recording."
category: "AI Agents"
publishedAt: "2026-11-25"
updatedAt: "2026-11-25"
documentation: "https://beui.dev/components/agents/voice-note"
markdown: "https://beui.dev/components/agents/voice-note.md"
license: "MIT"
---

# Voice Note

> A mic button that opens into a recording bar with a timer, a live waveform, discard and send. The bar springs out of the mic's circle to both sides, folds back into it on send, and the app owns the recording.

## Install

```bash
npx shadcn@latest add @beui/voice-note
```

## Dependencies

- `@floating-ui/dom`
- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

```tsx
"use client";

import { VoiceNote } from "@/components/agents/voice-note";

export function VoiceNoteUsage() {
  return (
    <VoiceNote
      className="max-w-sm"
      onRecordStart={() => {
        // Start your MediaRecorder here and pass its level to `level`.
      }}
      onSend={(durationMs) => {
        // Stop the recorder and upload the clip; durationMs is its length.
        void durationMs;
      }}
    />
  );
}
```

## API Reference

### VoiceNote

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `level` | `number \| MotionValue<number>` | — | No | Live input level from 0 to 1 while recording, as a number or a MotionValue. Without it the waveform idles softly. |
| `onRecordStart` | `(() => void)` | — | No | Called when recording starts. Start your recorder here; the component never opens the microphone. |
| `onDiscard` | `(() => void)` | — | No | Called when the recording is thrown away, from the discard button or Escape. |
| `onSend` | `((durationMs: number) => void)` | — | No | Called with the recording's length in ms when it is sent. |
| `maxDuration` | `number` | — | No | Stops recording and sends once it reaches this length, in seconds. Default: no limit |
| `disabled` | `boolean` | `false` | No | Blocks starting a recording. Default: false |
| `labels` | `Partial<{ record: string; send: string; discard: string; recording: string; sent: string; }>` | — | No | Override any built-in string, e.g. for translation. |
| `className` | `string` | — | No | Classes merged onto the root element. |

## About Voice Note

Voice Note is a React voice message recorder for chat and AI apps, built with Framer Motion. A mic button opens into a recording bar with discard, a recording dot and timer, a live waveform and send. The bar springs out of the mic's own circle to both sides at once, and sending folds it back into the centre, where the mic briefly shows a check. It morphs with a clip, so its width never animates and nothing around it shifts. The recording itself is yours: start your recorder in onRecordStart and pass the input level in, and the waveform moves with the voice.

### When to use it

- A chat or AI assistant accepts spoken messages next to typed ones.
- A support or feedback form lets people leave a quick voice note.
- A messaging app needs record, discard and send in one compact control.

### Accessibility

Record, discard and send are real buttons with names and tooltips. When recording starts focus moves to send, Escape discards, and focus returns to the mic when the bar closes. Recording and sending are announced in a polite live region; the timer and waveform are hidden from assistive technology. With reduced motion the bar fades instead of growing and the dot does not pulse.

### FAQ

**Does it record audio?**

No. It never opens the microphone. Start a MediaRecorder in onRecordStart, stop it in onSend or onDiscard, and pass the input level as level to drive the waveform.

**How do I limit the length?**

Set maxDuration in seconds, and the note is sent when it reaches that length.

## Source

- Registry detail: https://beui.dev/r/voice-note
- Raw source: https://beui.dev/r/voice-note/raw
- GitHub: https://github.com/starc007/ui-components
