Transport
Paused · Studio session
Groups named play, pause, previous, next, and stop controls with 44px targets.
Paused · Studio session
Three ways in. They share one source, so the pixels match whichever you pick.
npm install @noorddev/vlak-react
// once, next to your app's root
import "@noorddev/vlak-react/css";
import { PlaybackControls } from "@noorddev/vlak-react";Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/playback-controls.
npx @noorddev/vlak-cli add playback-controls
The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.
npx shadcn add https://vlak.dev/r/playback-controls.json
The same registry item, installed by shadcn's CLI.
<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />
No React. Link vlak.css and use the markup and classes below.
import { PlaybackControls } from "@noorddev/vlak-react";
<PlaybackControls playing={playing} onPlayingChange={setPlaying} onPrevious={restartTrack} previousLabel="Restart track" onNext={skipAhead} nextLabel="Skip ahead" />Named, keyboard-operable transport buttons. Playback state may be owned by a media element.
| Prop | Type | Default | Description |
|---|---|---|---|
playing | boolean | ||
defaultPlaying | boolean | false | |
onPlayingChange | (playing: boolean) => void | ||
onPrevious | () => void | ||
onNext | () => void | ||
onStop | () => void | ||
disabled | boolean | false | |
previousDisabled | boolean | false | |
nextDisabled | boolean | false | |
previousLabel | string | "Previous track" | |
nextLabel | string | "Next track" | |
label | string | "Playback controls" |
Also accepts HTMLAttributes<HTMLDivElement>.
| Keys | Does |
|---|---|
| Tab, Shift+Tab | Moves between enabled transport buttons. |
| Enter, Space | Activates the focused transport action. |
<div class="rs-playback-controls" role="group" aria-label="Playback controls"><button class="rs-btn-primary rs-playback-action" type="button" aria-label="Play">Play</button></div>