Introducing Nuvyx UI v1.0.0

Docs
Music Player

Music Player

A customizable music player component with multiple themes, playback controls, progress tracking, and responsive design.

Installation

Examples

Usage

import { MusicPlayer } from "@/components/ui/music-player";
export default function BasicUsage() {
  return (
    <MusicPlayer
      theme="default"
      trackTitle="Blinding Lights"
      artist="The Weeknd"
      album="After Hours"
      artwork="/path/to/artwork.jpg"
    />
  );
}
export function CustomizedPlayer() {
  const handlePlayPause = (isPlaying) => {
    console.log(`Playback ${isPlaying ? "started" : "paused"}`);
  };
 
  const handleTimeChange = (currentTime) => {
    console.log(`Current playback position: ${currentTime}s`);
  };
 
  return (
    <MusicPlayer
      theme="spotify"
      trackTitle="Sugar"
      artist="Maroon 5"
      album="V"
      artwork="/path/to/artwork.jpg"
      initialTime={30}
      totalDuration={240}
      controls={{
        shuffle: true,
        repeat: true,
        heart: false,
      }}
      onPlayPause={handlePlayPause}
      onTimeChange={handleTimeChange}
      onTrackEnd={() => console.log("Track finished playing")}
      className="rounded-xl shadow-lg"
    />
  );
}

Props

Music Player

PropTypeDefaultDescription
themestring"default"Visual theme of the music player (default, spotify, cosmic, nebula, or custom).
artworkstring"/placeholder.svg"Path to the album artwork image.
trackTitlestringundefinedTitle of the track being played.
artiststringundefinedName of the artist or band.
albumstring"After Hours"Name of the album.
initialTimenumber0Initial playback position in seconds.
totalDurationnumber217Total duration of the track in seconds.
classNamestring""Additional CSS classes to apply to the component.
autoPlaybooleanfalseWhether to start playback automatically.
onPlayPausefunctionundefinedCallback function triggered when play/pause is toggled.
onTimeChangefunctionundefinedCallback function triggered when playback time changes.
onTrackEndfunctionundefinedCallback function triggered when track playback ends.
controls{ shuffle?: boolean; repeat?: boolean; heart?: boolean; }{ shuffle: true, repeat: true, heart: true }Controls visibility of additional player controls.