> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/videojs/v10/llms.txt
> Use this file to discover all available pages before exploring further.

# MuteButton

> Accessible mute/unmute button with volume level state reflection.

`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.

<Note>
  Requires the `volume` feature to be registered with the player.
</Note>

## Import

```tsx theme={null}
import { MuteButton } from '@videojs/react';
```

## Basic Usage

```tsx theme={null}
import { MuteButton } from '@videojs/react';

function PlayerControls() {
  return <MuteButton />;
}
```

### Custom Render

```tsx theme={null}
import { MuteIcon, UnmuteIcon } from './icons';
import { MuteButton } from '@videojs/react';

function PlayerControls() {
  return (
    <MuteButton
      render={(props, state) => (
        <button {...props}>
          {state.muted ? <MuteIcon /> : <UnmuteIcon />}
        </button>
      )}
    />
  );
}
```

## Props

<ParamField path="render" type="ReactElement | ((props: HTMLProps, state: MuteButton.State) => ReactElement | null)">
  Custom render prop. Receives the computed HTML props and current state.
</ParamField>

<ParamField path="label" type="string | ((state: MuteButton.State) => string)">
  Override the automatic `aria-label`. By default: `"Mute"` when unmuted, `"Unmute"` when muted.
</ParamField>

<ParamField path="disabled" type="boolean">
  Disables the button.
</ParamField>

<ParamField path="className" type="string | ((state: MuteButton.State) => string)">
  CSS class name or a function that receives state and returns a class name.
</ParamField>

<ParamField path="style" type="CSSProperties | ((state: MuteButton.State) => CSSProperties)">
  Inline style or a function that receives state and returns a style object.
</ParamField>

## 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

```css theme={null}
/* Basic muted/unmuted toggle */
.mute-button[data-muted] .icon-muted { display: inline; }
.mute-button:not([data-muted]) .icon-unmuted { display: inline; }

/* Multi-level volume icons */
.mute-button[data-volume-level="off"] .icon-off { display: inline; }
.mute-button[data-volume-level="low"] .icon-low { display: inline; }
.mute-button[data-volume-level="medium"] .icon-medium { display: inline; }
.mute-button[data-volume-level="high"] .icon-high { display: inline; }
```

## Accessibility

Renders a `<button>` element. The `aria-label` updates automatically: `"Mute"` or `"Unmute"`. Keyboard activation: `Enter` / `Space`.
