Components / Audio
Music Player
Free Audio React component — MusicPlayerCard. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.
Full dark player card with cover art, album info, progress scrubber with times, and transport controls. Not a bar — the whole now-playing screen.
Preview

Midnight Dreams
The Weekend · After Hours
Setup
How to use
Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.
- 1
Run in your terminal:
$npm install clsx tailwind-merge lucide-react - 2
Copy
lib/cn.tsbelow. Skip if you already havecn(). - 3
Copy the code below and create
components/audio/music-player-card.tsxin your project. - 4
Import and render:
Exampleimport { MusicPlayerCard } from "@/components/audio/music-player-card";
lib/cn.ts
import { type ClassValue, clsx } from "clsx";import { twMerge } from "tailwind-merge";export function cn(...inputs: ClassValue[]) {return twMerge(clsx(inputs));}
components/audio/music-player-card.tsx
"use client";import { forwardRef, useState, type ComponentPropsWithoutRef } from "react";import Image from "next/image";import { cn } from "@/lib/cn";import { Play, Pause, SkipForward, SkipBack } from "lucide-react";export type MusicPlayerCardProps = Readonly<{coverImage?: string;title?: string;artist?: string;album?: string;currentTime?: string;duration?: string;progress?: number;defaultPlaying?: boolean;} & ComponentPropsWithoutRef<"div">>;// Production-ready Music Player component — styled with Tailwind CSS.export const MusicPlayerCard = forwardRef<HTMLDivElement, MusicPlayerCardProps>(({className,coverImage = "/wallpaper-3.png",title = "Midnight Dreams",artist = "The Weekend",album = "After Hours",currentTime = "1:24",duration = "3:42",progress = 42,defaultPlaying = true,...props},ref,) => {const [playing, setPlaying] = useState(defaultPlaying);return (<divref={ref}data-slot="music-player-card"className={cn("w-72 overflow-hidden rounded-2xl bg-neutral-950 font-sans shadow-lg",className,)}{...props}>{/* Cover */}<div data-slot="music-player-card-cover" className="relative h-36"><Imagesrc={coverImage}alt={title}fillsizes="288px"className="object-cover opacity-80"/><divdata-slot="music-player-card-overlay"className="absolute inset-0 bg-linear-to-t from-neutral-950 via-neutral-950/40 to-transparent"/></div><divdata-slot="music-player-card-content"className="relative -mt-6 p-4">{/* Track Info */}<div data-slot="music-player-card-info"><h3 className="text-sm font-semibold text-white">{title}</h3><p className="text-[11px] text-neutral-500">{artist} · {album}</p></div>{/* Progress */}<div data-slot="music-player-card-progress" className="mt-4"><div className="h-1 overflow-hidden rounded-full bg-neutral-800"><divclassName="relative h-full rounded-full bg-emerald-500"style={{width: `${Math.min(Math.max(progress, 0), 100)}%`,}}><div className="absolute top-1/2 right-0 h-2.5 w-2.5 -translate-y-1/2 rounded-full bg-white shadow" /></div></div><div className="mt-1 flex justify-between"><span className="font-mono text-[9px] text-neutral-600">{currentTime}</span><span className="font-mono text-[9px] text-neutral-600">{duration}</span></div></div>{/* Controls */}<divdata-slot="music-player-card-controls"className="mt-3 flex items-center justify-center gap-5"><buttontype="button"aria-label="Previous track"className="cursor-pointer text-lg text-neutral-500 transition-colors hover:text-white"><SkipBack size={14} /></button><buttontype="button"aria-label={playing ? "Pause" : "Play"}onClick={() => setPlaying((prev) => !prev)}className="flex h-10 w-10 cursor-pointer items-center justify-center rounded-full bg-white transition-transform hover:scale-105">{playing ? (<Pause size={14} fill="black" />) : (<Play size={14} fill="black" />)}</button><buttontype="button"aria-label="Next track"className="cursor-pointer text-lg text-neutral-500 transition-colors hover:text-white"><SkipForward size={14} /></button></div></div></div>);},);MusicPlayerCard.displayName = "MusicPlayerCard";