Step Player
betaA stepped progress track with a play, pause and replay button: the current dot stretches into a bar that fills over its duration.
- Feedback
- 1 file
- 1 npm package
- Accessibility notes
pnpm dlx @dowel-ui/cli add step-playernpm packages installed: class-variance-authority.
import { StepPlayer } from "@/components/ui/step-player";Default
Gallery
Playing
Loop
Seekable
Per Step Durations
Sizes
Control At End
Track Only
Driven By You
Right To Left
<StepPlayer>
| Prop | Type | Default |
|---|---|---|
controlLabelsAccessible names of the button in each state, for localisation. | { play?: string; pause?: string; replay?: string } | — |
controlPositionWhich side of the track the button sits on. | "start" | "end" | "start" |
defaultPlayingWhether it starts running when uncontrolled. | boolean | false |
defaultValueInitial step when uncontrolled. Clamped to the last step. | number | 0 |
durationMilliseconds per step. 0 stops the timer so you drive | number | 3000 |
labelAccessible name of the track. | string | "Progress" |
loopWrap to the first step instead of stopping. The replay button never appears. | boolean | false |
onCompleteFires when the last step finishes — on every pass when looping. | () => void | — |
onPlayingChangeFires when the button is pressed, and when the last step ends without | (playing: boolean) => void | — |
onValueChangeFires when the step advances, wraps, is chosen, or restarts on replay. | (value: number) => void | — |
playingControlled play state. | boolean | — |
seekableSteps can be chosen by click, tap or keyboard. | boolean | false |
showControlShow the round play / pause / replay button. | boolean | true |
sizeHeight of the track and button in pixels; everything else is a ratio of it. | number | 32 |
stepsHow many steps, or one entry per step with its own duration and label. | number | StepPlayerStep[] | 5 |
track | "filled" | "plain" | "filled" |
valueControlled active step, zero-based. | number | — |
Plus every attribute of <div> except defaultValue, onChange.
10/10
checks passed
- Tested — passes
- axe assertion — passes
- Keyboard tested — passes
- Storybook examples — passes
- Accessibility documented — passes
- Semantic tokens only — passes
- Motion from tokens — passes
- className merged — passes
- Visible focus — passes
- No fixed widths — passes