Music Toggle

Open in v0

Last updated: September 20, 2026

A play/pause control shaped like a spinning record, with a live waveform and a seekable progress ring.

Installation

npx smoothui-cli add music-toggle

Features

Play/pause control shaped like a spinning record with a live waveform and seekable progress ring. Caller-driven or self-contained with an optional <audio> element.

Modes

Player

Full player with title, artist, seek ring, and waveform. Pass playing, onPlayingChange, progress, and onSeek — or supply src and let the component own playback.

Caller-driven

Purely visual when you drive playing yourself — no <audio> element. Useful for previews and design systems where audio would be hostile.

Accessibility

Keyboard Interactions

KeyDescription
Space / EnterToggles play/pause (native <button> behavior)
Arrow Right / Arrow UpSeeks forward, when onSeek is provided
Arrow Left / Arrow DownSeeks backward, when onSeek is provided
Home / EndJumps to the start / end of the track

ARIA Attributes

AttributeElementPurpose
aria-pressedPlay/pause buttonReflects the current playing state
aria-labelPlay/pause buttonReads "Play"/"Pause" plus the track title and artist
role="slider"Progress ringExposes the seek control to assistive technology
aria-valuenow / aria-valuemin / aria-valuemaxProgress ringExposes playback position as a 0–100 percentage
aria-hidden="true"Cover art, waveformHides purely decorative visuals

Screen Reader

  • The play/pause button is a real <button>, so it is announced with its role, pressed state and label out of the box.
  • The waveform bars are aria-hidden; they carry no information not already exposed by the play/pause state.
  • The seek ring is only focusable (tabIndex={0}) when onSeek is supplied — otherwise it is skipped by keyboard navigation.

Reduced Motion

This component respects the prefers-reduced-motion media query via useReducedMotion from Motion. When reduced motion is preferred, the cover art stops rotating, the waveform bars stop animating, and the play/pause icon swaps instantly instead of morphing.

Props

Created by

Powered by

motion.dev

© 2026 SmoothUI. Built by Eduardo Calvo.