🎵 Skeumorphic Music Card
The Skeumorphic Music Card is a stylish React.js + Tailwind CSS music player with realistic shadows, beveled edges, and tactile buttons. Featuring play, pause, skip, and progress tracking, it's perfect for music apps, audio players, or portfolio projects. 🎵✨
Preview
David Dallas
Follow below steps 👇🏻
Install dependencies
1npm i lucide-react
Component
Create a file skeumorphic-music-card.tsx in your components folder and paste this code
1'use client';23import { Play, Pause, SkipForward, SkipBack } from 'lucide-react';4import { useState } from 'react';56interface SkeumorphicMusicCardProps {7title: string;8artist: string;9cover: string;10className?: string;11}1213const ControlButton = ({14isPressed,15onMouseDown,16onMouseUp,17onMouseLeave,18onTouchStart,19onTouchEnd,20onClick,21children,22size = 'small'23}: {24isPressed: boolean;25onMouseDown: () => void;26onMouseUp: () => void;27onMouseLeave: () => void;28onTouchStart: () => void;29onTouchEnd: () => void;30onClick?: () => void;31children: React.ReactNode;32size?: 'small' | 'large';33}) => (34<div35className="rounded-full p-[3px] border-[1px] border-black/5"36style={{37background: 'linear-gradient(135deg, #c2d9f0 0%, #e6f0fa 100%)',38boxShadow: 'inset 1px 1px 2px rgba(255,255,255,0.6), inset -1px -1px 2px rgba(0,0,0,0.1)'39}}40>41<button42onClick={onClick}43onMouseDown={onMouseDown}44onMouseUp={onMouseUp}45onMouseLeave={onMouseLeave}46onTouchStart={onTouchStart}47onTouchEnd={onTouchEnd}48style={{49boxShadow: isPressed50? 'inset 3px 3px 7px rgba(0,0,0,0.2), inset -1px -1px 3px rgba(255,255,255,0.5)'51: '-3px -3px 7px rgba(255,255,255,0.7), 3px 3px 7px rgba(0,0,0,0.2)',52background: isPressed53? 'linear-gradient(135deg, #c2d9f0 0%, #d9e6f2 100%)'54: 'linear-gradient(135deg, #e6f0fa 0%, #c2d9f0 100%)',55transform: isPressed ? 'scale(0.95)' : 'scale(1)'56}}57className={`rounded-full transition-all duration-75 text-gray-700 hover:text-gray-900 ${58size === 'large' ? 'p-4' : 'p-2'59}`}60>61{children}62</button>63</div>64);6566const ProgressBar = () => (67<div68style={{69boxShadow: 'inset 2px 2px 3px rgba(0,0,0,0.1), inset -1px -1px 3px rgba(255,255,255,0.7)',70background: 'linear-gradient(135deg, #c2d9f0 0%, #d9e6f2 100%)'71}}72className="h-2 rounded-full overflow-hidden"73>74<div75style={{76width: '35%',77background: 'linear-gradient(135deg, #6fa8dc 0%, #3d85c6 100%)',78boxShadow: '1px 1px 2px rgba(255,255,255,0.3)'79}}80className="h-full rounded-full"81/>82</div>83);8485const SkeumorphicMusicCard = ({ title, artist, cover, className }: SkeumorphicMusicCardProps) => {86const [isPlaying, setIsPlaying] = useState(false);87const [isPlayButtonPressed, setIsPlayButtonPressed] = useState(false);88const [isBackButtonPressed, setIsBackButtonPressed] = useState(false);89const [isForwardButtonPressed, setIsForwardButtonPressed] = useState(false);9091const togglePlayPause = () => setIsPlaying(!isPlaying);9293return (94<div95style={{96boxShadow: 'inset -8px -8px 15px rgba(255,255,255,0.8), inset 8px 8px 15px rgba(0,0,0,0.2)',97background: 'linear-gradient(135deg, #e6ecf0 0%, #cfd8e2 100%)'98}}99className={`p-5 rounded-[30px] border-[1px] border-black/5 ${className}`}100>101<div102style={{103boxShadow:104'inset 2px 2px 5px rgba(255,255,255,0.7), inset -2px -2px 5px rgba(0,0,0,0.1), 5px 5px 15px rgba(0,0,0,0.1)',105background: 'linear-gradient(135deg, #e6f0fa 0%, #c2d9f0 100%)'106}}107className="relative w-80 p-6 rounded-[20px] flex flex-col items-center border-[1px] border-black/5"108>109{/* Album Cover */}110<div111style={{112boxShadow: '-2px -2px 5px rgba(255,255,255,0.5), 5px 5px 15px rgba(0,0,0,0.3)'113}}114className="w-40 h-40 rounded-xl overflow-hidden"115>116<img src={cover} alt={title} className="w-full h-full object-cover" />117</div>118119{/* Song Info */}120<div className="mt-6 text-center">121<h3 className="text-lg font-semibold text-gray-800">{title}</h3>122<p className="text-sm text-gray-600">{artist}</p>123</div>124125<div className="w-full mt-6 px-2">126<ProgressBar />127</div>128129{/* Controls */}130<div className="flex items-center justify-center gap-5 w-full px-2 mt-3">131<ControlButton132isPressed={isBackButtonPressed}133onMouseDown={() => setIsBackButtonPressed(true)}134onMouseUp={() => setIsBackButtonPressed(false)}135onMouseLeave={() => setIsBackButtonPressed(false)}136onTouchStart={() => setIsBackButtonPressed(true)}137onTouchEnd={() => setIsBackButtonPressed(false)}138>139<SkipBack size={22} />140</ControlButton>141142<ControlButton143isPressed={isPlayButtonPressed}144onMouseDown={() => setIsPlayButtonPressed(true)}145onMouseUp={() => setIsPlayButtonPressed(false)}146onMouseLeave={() => setIsPlayButtonPressed(false)}147onTouchStart={() => setIsPlayButtonPressed(true)}148onTouchEnd={() => setIsPlayButtonPressed(false)}149onClick={togglePlayPause}150size="large"151>152{isPlaying ? <Pause size={24} /> : <Play size={24} />}153</ControlButton>154155<ControlButton156isPressed={isForwardButtonPressed}157onMouseDown={() => setIsForwardButtonPressed(true)}158onMouseUp={() => setIsForwardButtonPressed(false)}159onMouseLeave={() => setIsForwardButtonPressed(false)}160onTouchStart={() => setIsForwardButtonPressed(true)}161onTouchEnd={() => setIsForwardButtonPressed(false)}162>163<SkipForward size={22} />164</ControlButton>165</div>166</div>167</div>168);169};170171export default SkeumorphicMusicCard;
Usage
1<SkeumorphicMusicCard2title="Sideline"3artist="David Dallas"4cover="https://t2.genius.com/unsafe/680x680/https%3A%2F%2Fimages.genius.com%2Fcd9ba63203bb2d02e141581abf7beeb7.640x640x1.jpg"5/>
⭐️ Got a question or feedback?
Feel free to reach out!