MuteButton toggles mute on and off. It also exposes a derived volumeLevel based on the current volume and mute state, enabling multi-level volume icons.
Requires the
volume feature to be registered with the player.Import
Basic Usage
Custom Render
Props
Custom render prop. Receives the computed HTML props and current state.
Override the automatic
aria-label. By default: "Mute" when unmuted, "Unmute" when muted.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.
| Attribute | Value / Description |
|---|---|
data-muted | Present when media is muted. |
data-volume-level | "off" | "low" | "medium" | "high" — derived from volume and mute state. |
CSS Styling Example
Accessibility
Renders a<button> element. The aria-label updates automatically: "Mute" or "Unmute". Keyboard activation: Enter / Space.