Voice note from Riley
Silent preview. Pass a src to play a real file.
Installation
$ pnpm dlx shadcn@latest add @synccn/audio-playerFirst time in this project? Connect synccn with one command.
Usage
import { AudioPlayer } from "@/components/ui/audio-player";<AudioPlayer src="/note.mp3" />API reference
Generated from the component's TypeScript types, so it always matches the code.
AudioPlayer
Voice-note style player with a clickable waveform. Pass `src` for a real audio file; without one it runs a silent preview for `duration` seconds.
- src
stringAudio file URL. Without it the player runs a silent preview.
- duration
numberDefault
42Length in seconds for the silent preview (read from the file when src is set).
- bars
numberDefault
48Number of waveform bars.
- title
React.ReactNodeLabel above the waveform.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
Helpers
- lib/utilscn (merges class names)
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Pause, Play
Accessibility
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA roles: slider
- ARIA attributes: aria-label, aria-valuemax, aria-valuemin, aria-valuenow
- Keys handled: ArrowLeft, ArrowRight
- Shows a visible focus ring for keyboard users