LyricsView
Time-synced lyrics. The line being sung is large and sharp, the rest fade and blur with distance, the list glides to keep it centred, and pressing a line seeks to it. Media.
Open playgroundAbout
LyricsView is a React component in the Media category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { LyricsView } from "@ashutoshswamy/smoui" and set lines, currentTime, onSeek among its 4 props.
Install
npm i @ashutoshswamy/smouiUsage
import { LyricsView } from "@ashutoshswamy/smoui";
<LyricsView lines={[{ time: 0, text: "First line" }, { time: 4, text: "Second line" }]} currentTime={time} onSeek={seek} />Props 4
- lines
Start time in seconds and the text of each line.
{ time: number; text: string }[]- currentTime
Playhead in seconds.
number- onSeek
A line was pressed.
(seconds: number) => void- height
Height of the scrolling area.
numberdefault320
More media components
- MiniPlayerA compact player pill. The play button wears a progress ring, the title slides the way you skip, and the bars on the art settle when the music stops.
- TrackListRows of tracks. The loaded one gets a highlight that glides to it and animated bars while it plays, hovering a row turns its number into a play arrow, and arrow keys move between rows.
- VinylPlayerA record you can touch. It spins with inertia, stops dead under your finger, and turning it scrubs the song. The tonearm drops on play, creeps toward the label as the song goes, and lifts on pause.
- VolumeControlA speaker button and a volume track. Dragging or arrow keys set the level, the icon follows it, and the button mutes and brings the old level back.
- WaveformScrubberAn audio seek bar drawn as a waveform. The played part fills with the accent, hovering previews a time, dragging scrubs, and arrow keys step five seconds.