A dark music player built with Tailwind CSS that pairs large album art and transport controls with a clickable "Up next" playlist. The blurred cover glows behind a frosted glass panel, and choosing a track swaps the artwork, title and duration. It works well for artist pages, label sites, streaming app mockups and playlist embeds.
How it works
The root is section.tap-player. A blurred copy of the cover (data-tap-backdrop) and a gradient overlay sit behind a glass panel with backdrop-blur-xl. From md up the panel is a two-column grid; on phones the playlist moves below the player. The left column holds the data-tap-cover image, the data-tap-title and data-tap-artist text, a like button, the data-tap-seek range with elapsed and total time, the shuffle, previous, play, next and repeat buttons, and a volume slider. The right column is an ordered list of .tap-track buttons; each one stores its large image in data-tap-art, plus data-tap-alt, data-tap-title, data-tap-artist and data-tap-duration (seconds).
The script initializes every .tap-player on DOMContentLoaded. Clicking a row sets aria-current="true" on it, updates the cover, backdrop and text, and starts playback. The play button toggles the tap-is-playing class, which animates the .tap-eq bars on the current row and slightly scales the cover. Playback is a simulated clock; at the end of a track it repeats when repeat is on, jumps to a random track when shuffle is on, or moves to the next one. "Previous" restarts the song first and only goes back when pressed near the start. For real audio, connect an audio element and drive the same functions from its timeupdate and ended events.
All artwork photos come from Unsplash; replace them with your own album covers.
Customization
- Add a
liwith a.tap-trackbutton to thedata-tap-listlist: fill in itsdata-tap-*attributes and a 96 px thumbnail. accent-fuchsia-400,text-fuchsia-300andaria-pressed:text-fuchsia-400: swapfuchsiaforemeraldorskyto change the highlight color.bg-[#140b24]on.tap-player: change the base background and the matching gradient overlay colors.opacity-40 blur-3xlondata-tap-backdrop: raise the opacity for a stronger album glow, or remove the image for a flat background.max-w-[272px]ondata-tap-cover: enlarge or shrink the album art.md:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]: rebalance the player and playlist columns.
Use cases
- Music and band websites: large album art with a blurred cover backdrop sets the mood
- Artist portfolios: transport controls, seek and volume sliders give full playback control
- Streaming prototypes: a clickable playlist lets users switch the current track in a prototype quickly
- Podcast and audio sites: a dark player with large cover art fits media-focused pages for listeners
Accessibility
Every icon button has a hidden text label, and the play button's aria-label switches between "Play" and "Pause". Shuffle, repeat and like use aria-pressed, and the playing row is marked with aria-current. The seek slider exposes an aria-valuetext like "1:24 of 3:42", and track changes are announced through a polite live region. Focus outlines are visible on all controls, and the equalizer and cover animations stop under prefers-reduced-motion.