PlayButton is a three-state button that toggles between play, pause, and replay. When media reaches the end, clicking it restarts playback from the beginning.
Requires the
playback feature to be registered with the player.Import
Basic Usage
Custom Render
Use therender prop to fully customize the button element while keeping all accessibility and state wiring:
Props
Custom render prop. Receives the computed HTML props and current state. Use this to render a custom button element or icon set.
Override the automatic
aria-label. By default the label is "Play", "Pause", or "Replay" depending on state.Disables the button.
CSS class name or a function that receives state and returns a class name.
Inline style or a function that receives state and returns a style object.
State Data Attributes
These attributes are reflected on the rendered<button> element and can be used for CSS-based state styling.
| Attribute | Description |
|---|---|
data-paused | Present when media is paused. |
data-ended | Present when media has ended. |
data-started | Present after the first play. Remains until a new source is loaded. |
data-waiting | Present when media is waiting/buffering. |
CSS Styling Example
Accessibility
Renders a<button> element. The aria-label updates automatically: "Play", "Pause", or "Replay". Keyboard activation: Enter / Space.