---
title: MuteButton
frameworkTitle:
html: mute-button
description: A button component for toggling audio mute state
---
import { MuteButtonDemo } from '@/examples/react/MuteButton/MuteButtonDemo';
import componentModuleStr from '@/examples/react/MuteButton/BasicMuteButton.tsx?raw';
import cssModuleStr from '@/examples/react/MuteButton/MuteButton.module.css?raw';
import htmlStr from '@/examples/html/mute-button/snippet.html?raw';
import htmlCssStr from '@/examples/html/mute-button/mute-button.css?raw';
import htmlJsStr from '@/examples/html/mute-button/mute-button.js?raw';
import FrameworkCase from '@/components/docs/FrameworkCase.astro';
import ServerCode from '@/components/Code/ServerCode.astro';
import { TabsRoot, TabsPanel } from '@/components/Tabs';
## Features
- Multi-state icon display (high, low, off)
- Automatically reflects volume level changes
- Toggles mute/unmute on click
- Accessible keyboard navigation
## Example
## Data Attributes
The MuteButton automatically sets data attributes based on volume level:
- `data-volume-level="high"` - Volume > 50%
- `data-volume-level="medium"` - Volume 25-50%
- `data-volume-level="low"` - Volume 1-24%
- `data-volume-level="off"` - Volume 0% (muted)
Use these attributes for state-based styling in your CSS.
## Props
All standard button props are supported, plus:
| Prop | Type | Description |
|------|------|-------------|
| `children` | `ReactNode` | Button content (typically icons) |
| `className` | `string` | CSS class name |
## Accessibility
- Automatically includes proper ARIA labels
- Keyboard accessible (Space/Enter)
- Announces volume state changes to screen readers