PlayButton

Play and pause trade places inside a round button. It breathes while playing, and an optional ring tracks progress. Buttons.

Open playground

About

PlayButton is a React component in the Buttons category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { PlayButton } from "@ashutoshswamy/smoui" and set playing, defaultPlaying, onChange among its 5 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { PlayButton } from "@ashutoshswamy/smoui";

<PlayButton playing={playing} onChange={setPlaying} progress={time / duration} />

Props 5

playing

Controlled state.

boolean
defaultPlaying

Starting state when uncontrolled.

boolean
onChange

Called on every toggle.

(playing: boolean) => void
progress

0-1. Adds a ring that fills to this value.

number
size

Diameter in px. Default 64.

number