HelpTribe.

MediaPlayer

Compact media player with playback controls and animated waveform visualization. Two variants: controls (shuffle, prev/play/next, repeat, volume) and waveform (animated bars with time display).

Installation

$ npx shadcn@latest add media-player

Preview

Controls Variant

Waveform Variant

3:41

Waveform Variant

3:41

Usage (React/TSX)

import { MediaPlayer } from "@/components/ui/media-player"

export default function MusicWidget() {
  const [isPlaying, setIsPlaying] = useState(false);

  return (
    <MediaPlayer
      variant="controls"
      isPlaying={isPlaying}
      onPlayPause={() => setIsPlaying(!isPlaying)}
    />
  )
}

Props

PropTypeDefaultDescription
variant"controls" | "waveform""controls"The visual style of the player.
isPlayingbooleanfalseWhether the player is currently playing.
onPlayPause() => voidβ€”Callback when play/pause is clicked.
currentTimestring"3:41"Current time display (waveform variant).
progressnumber65Progress percentage (0-100).
classNamestringβ€”Additional CSS classes to apply.

Design Notes

  • Controls variant: dark pill with white center section for playback controls.
  • Waveform variant: animated bars that pulse when playing, static when paused.
  • Shuffle, repeat, and volume have toggle states with visual feedback.
  • All buttons have hover scale transitions for tactile feel.
  • Use for music players, podcast controls, audio previews.