# UI Sounds · Pro

Forty-five interface sounds (clicks, toggles, success, error, notifications, whooshes, coins and more) synthesised live with the Web Audio API. No audio files, a playSound function, a useSound hook and a shared on/off switch.

This is a Charcoal UI Pro component. Its source and examples are available with a Pro seat: https://charcoalui.com/pricing

## With a Pro seat

1. Add the registry to components.json:

```json
{
  "registries": {
    "@charcoal": {
      "url": "https://charcoalui.com/r/{name}.json",
      "headers": {
        "Authorization": "Bearer ${CHARCOAL_LICENSE_KEY}"
      }
    }
  }
}
```

2. Copy your licence key from https://charcoalui.com/dashboard and put it in .env.local as CHARCOAL_LICENSE_KEY, then:

```bash
npx shadcn@latest add @charcoal/ui-sounds
```

To read Pro source through this MCP server, reconnect it with the header "Authorization: Bearer <licence key>".

## API — UI Sounds
| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `playSound(name, options?)` | `(name: SoundName, { volume?, pitch?, force? }) => void` | — | Plays once. force ignores the off switch. |
| `useSound(name, options?)` | `() => void` | — | A stable play function for event handlers. |
| `useSoundsEnabled()` | `[on: boolean, set: (on: boolean) => void]` | — |  |
| `setSoundsEnabled(on)` | `(on: boolean) => void` | — | Remembered in localStorage. |
| `sounds` | `Record<SoundName, Voice[]>` | — | The definitions; add your own. |

See it live: https://charcoalui.com/docs/components/ui-sounds