Components

Voice Sample Player

An audio player pill with a waveform equalizer that reveals on play.

A voice-sample row: press play and the name slides up and out, a lime waveform equalizer slides in and starts oscillating, and the button morphs from play to pause. Pass a src to play real audio. Driven by GSAP.

New tab
Ada Lovelace

Ada Lovelace

British female · warm & precise

Grace Hopper

Grace Hopper

American female · clear & confident

Alan Turing

Alan Turing

British male · calm & thoughtful

Installation

pnpm dlx shadcn@latest add @tween-ui/voice-sample-player

Usage

app/page.tsx
app/page.tsx
import VoiceSamplePlayer from '@/components/tweenui/media/voice-sample-player';
 
export default function Page() {
  return (
    <VoiceSamplePlayer
      name="Ada Lovelace"
      description="British female · warm & precise"
      avatar="/avatars/ada.jpg"
      src="/audio/ada-sample.mp3"
    />
  );
}

To keep only one player active at a time, control playing from the parent:

app/page.tsx
app/page.tsx
const [activeId, setActiveId] = useState<string | null>(null);
 
<VoiceSamplePlayer
  name="Ada Lovelace"
  playing={activeId === 'ada'}
  onPlayingChange={(next) => setActiveId(next ? 'ada' : null)}
/>;

Props

PropTypeDefaultDescription
namestring—Speaker / voice name.
descriptionstring—Short line under the name (accent, tone, …).
avatarstring—Avatar image URL; falls back to the name initials.
avatarAltstringnameAlt text for the avatar.
srcstring—Audio file to play. Omit to animate without sound.
playingboolean—Controlled playing state.
defaultPlayingbooleanfalseUncontrolled initial state.
onPlayingChange(playing: boolean) => void—Fires when playback starts or stops.

Accessibility

The play button is a real <button> with aria-pressed and an aria-label that flips between "Play" and "Pause". The waveform is decorative (aria-hidden). Under prefers-reduced-motion: reduce the label and waveform swap instantly with no slide, and the equalizer holds a static shape.