Music Player

Controls playback in one bar: track identity, transport, and a scrub slider.

Signal DriftLyra Voss
0:00
-3:41

Configurations

Supported configurations for this component.

Configurations

7 examples
Playing
Signal DriftLyra Voss
0:00
-3:41
Paused
Signal DriftLyra Voss
1:36
-2:05
Liked
Signal DriftLyra Voss
1:36
-2:05
Muted
Signal DriftLyra Voss
1:36
-2:05
At the end
Signal DriftLyra Voss
3:41
-0:00
Shuffle and repeat on
Signal DriftLyra Voss
1:36
-2:05
Single track
Signal DriftLyra Voss
1:36
-2:05

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
track{ title: string, subtitle: string, cover: string | null }DEFAULT_TRACKTrack identity shown in the metadata region.
playingbooleanfalsePlay state; the internal fallback's initial value when onTogglePlay is omitted.
elapsednumber-Controlled elapsed seconds; supplying it stops the internal demo timer. Omitted, the timer runs from zero (onSeek alone does not make it controlled).
durationnumber221Track length in seconds.
volumenumber72Volume 0..100; local fallback when onVolumeChange is omitted.
likedbooleanfalseLiked state; local fallback when onLike is omitted.
onTogglePlay() => void-Primary play/pause handler; omission enables local play state.
onSeek(seconds: number) => void-Scrub handler; with `elapsed` omitted, scrubs also move the local timer.
shufflebooleanfalseShuffle state, shown as a pressed Shuffle button. It changes only through onShuffle.
repeatbooleanfalseRepeat state, shown as a pressed Repeat button. It changes only through onRepeat.
onNext() => void-Next-track handler; without it the Next button renders disabled.
onPrev() => void-Previous-track handler; without it the Previous button renders disabled.
onShuffle() => void-Shuffle handler; without it the Shuffle button renders disabled.
onRepeat() => void-Repeat handler; without it the Repeat button renders disabled.
onLike() => void-Like-toggle handler; omission enables local liked state.
onVolumeChange(volume: number) => void-Volume handler; omission enables local volume state.
onLyrics() => void-Lyrics handler; the Lyrics button renders only when provided.
classNamestring-Additional CSS classes applied to the root element.
styleReact.CSSProperties-Inline styles applied to the root element.

More Andromeda Pro components