Requirements
- Node.js 20 or later
- A project with a
package.json. Run the CLI from your app’s root, or pass--cwd <path>. - React 18 or later, only if you use the React hooks
Set up audx
1
Run init
init asks where sound files should go (src/sounds by default) and which theme to use, then:- writes
audx.jsonwith your choices - installs
@litlab/audxwith your package manager - lets you pick a starter set of sounds
click, toggle, select, open, close, copy, success, error and notify.2
Play a sound
Each sound is exported from your sounds directory. Import it and call it:The CLI picks up path aliases from
tsconfig.json or jsconfig.json. Without an alias, import from a relative path such as ./src/sounds.3
Add more sounds
add with no arguments to open an interactive picker, or list to browse the catalog:Use it in React
useSound returns a stable callback that respects <SoundProvider> and the user’s prefers-reduced-motion setting:
Switch the theme
Every built-in theme has the same 43 sounds, so switching themes changes how your app sounds without changing your code:What gets generated
src/sounds/click.ts
tsconfig.json, the CLI writes .js files instead.