Browse components

component

Voice Note

An audio message with the sender's avatar and the mic badge that turns blue until it is played.

Install

npx shadcn@latest add https://whatsapp-components.crafter.run/r/voice-note.json

Writes 7 files into your project, and installs clsx and tailwind-merge.

Preview

0:27
0:41
demos/voice-note.tsx
import { MessageBubble } from "@/registry/whatsapp/message-bubble";
import { MessageMeta } from "@/registry/whatsapp/message-meta";
import { VoiceNote } from "@/registry/whatsapp/voice-note";

export default function Demo() {
  return (
    <div className="flex flex-col gap-3">
      <MessageBubble
        direction="in"
        meta={<MessageMeta timestamp={new Date(2025, 0, 6, 18, 18)} />}
      >
        <VoiceNote senderName="Camila" durationSeconds={27} unplayed />
      </MessageBubble>

      <MessageBubble
        direction="out"
        meta={
          <MessageMeta timestamp={new Date(2025, 0, 6, 18, 20)} status="read" />
        }
      >
        <VoiceNote
          senderName="Valeria"
          durationSeconds={41}
          progress={0.6}
          playing
        />
      </MessageBubble>
    </div>
  );
}

Props

Read from VoiceNoteProps in the component source at build time.

VoiceNoteProps
PropTypeDefault
durationSecondsrequirednumber—
senderNamerequired

Sender shown beside the waveform, with the little mic badge.

string—
classNamestring—
onPlayToggle() => void—
playingboolean—
progress

Playback position from 0 to 1; bars before it are filled.

number—
senderAvatarUrlstring—
unplayed

Turns the unplayed dot on, as WhatsApp marks a new voice note.

boolean—
waveform

Bar heights from 0 to 1. Falls back to a stable stand-in.

number[]—

Files

  • registry/whatsapp/voice-note.tsx
  • registry/whatsapp/audio-message.tsx
  • registry/whatsapp/chat-avatar.tsx
  • registry/whatsapp/format-media.ts
  • registry/whatsapp/cn.ts
  • registry/whatsapp/whatsapp.css
  • LICENSE