ReferenceButtons
MuteButton
Accessible mute/unmute button with keyboard support and volume state reflection
Import
Anatomy
Behavior
Toggles mute on and off, and exposes a derived volumeLevel based on the current volume and mute state.
Mute availability is separate from volume-level availability because some media can accept a mute command without supporting volume changes.
When mute is unavailable or unsupported, the component returns null. Toggling is also ignored while mute is unavailable.
Styling
Style the button based on muted state:
React renders a <button> element. Add a className to style it:
Use data-volume-level for multi-level icon switching:
Unavailable and unsupported buttons are hidden automatically. No availability selector or extra hiding CSS is required.
Accessibility
Renders a <button> with an automatic aria-label: “Unmute” when muted, “Mute” when unmuted. Override with the label prop. Keyboard activation: Enter / Space.