Playback controls

Groups named play, pause, previous, next, and stop controls with 44px targets.

Transport

Paused · Studio session

Use it for

  • Transport controls beside media metadata or inside a player.
  • Custom previous and next labels when actions restart or seek.

Not for

  • A media source by itself; use MediaPlayer to bind to audio or video.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

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.

2. Vendor the source

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.

3. Through shadcn

npx shadcn add https://vlak.dev/r/playback-controls.json

The same registry item, installed by shadcn's CLI.

CSS only

<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" />

PlaybackControls

Named, keyboard-operable transport buttons. Playback state may be owned by a media element.

PropTypeDefaultDescription
playingboolean
defaultPlayingbooleanfalse
onPlayingChange(playing: boolean) => void
onPrevious() => void
onNext() => void
onStop() => void
disabledbooleanfalse
previousDisabledbooleanfalse
nextDisabledbooleanfalse
previousLabelstring"Previous track"
nextLabelstring"Next track"
labelstring"Playback controls"

Also accepts HTMLAttributes<HTMLDivElement>.

KeysDoes
Tab, Shift+TabMoves between enabled transport buttons.
Enter, SpaceActivates 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>
.rs-playback-controls.rs-playback-action