Skip to content
Site volume
Colourway

Components

Sound toggle

Turns the wood knocks, stamp thumps and comic sounds on or off. Sound starts off.

Import from@maxgrits/overprint-react/sound
On this page

Sound is off until a visitor turns it on (D-H4). The toggle only sets the preference; the sound engine obeys it and opens its audio context inside that same click. Quiet stays silent, Studio plays a little softer.

Example#

Look of this example
Live render of examples/sound-toggle/basic.tsx

Usage#

Use the sound toggle wherever the site can make sound. Sound is off until a visitor turns it on (D-H4); the toggle sets the preference, and the sound engine plays only while it is on.

  • icon (default) is an icon key with the sound-on and sound-off glyphs; labelled says the state in words, "Sound off" or "Sound on", for the visitor controls.
  • No audio until asked. The engine opens its audio context inside the click that turns sound on, so nothing loads before.

Anatomy#

The parts of examples/sound-toggle/basic.tsx, numbered:
  1. Icon keyPressed while sound is on..mk-sound-toggle.mk-icon-button
  2. Labelled keySound off or Sound on, in words..mk-sound-toggle.mk-button

Volume#

Reading layer: identical at every volume. Sound is never tied to the volume: Rave stays silent until a visitor asks.

  • Quiet

    Docs, forms, legal and long reads. Flat inks, no art in motion.

  • Studio

    The site default. Art on its own plates, one display moment per view.

  • Press

    Hero moments, covers and campaigns. Halftone fields and the second ink.

  • Rave

    Launches, posters and the 404. Every ink, and the words still win.

Content#

  • The words are "Sound off" and "Sound on"; the key's name says the current state.

Do and don't#

Do

Silent until asked.

Don't

A page that plays a wood knock on load and offers a mute key.

Sound first, mute later.

Unexpected sound startles people and embarrasses them in public. Sound is a choice a visitor makes, never a default.

Accessibility#

  • A real button with aria-pressed: pressed means sound is on. The icon key's name and the labelled key's words say the state, "Sound off" or "Sound on", and the speaker glyph follows.
  • The choice persists (localStorage mk-sound) and PrefsScript sets <html data-mk-sound> before the first paint.
  • Nothing plays before a visitor asks for it, and reduced motion does not mute it: sound is not motion.

Props#

PropTypeDefaultDescription
appearance"icon" | "labelled"none
copyPartial<SoundToggleCopy>none
sizeSizenoneThe key size (40 / 44 / 52 px icon squares; 40 / 48 / 56 px labelled keys).
classNamestringnone

Generated from SoundToggleProps in packages/overprint-react/src/sound/sound-toggle.tsx.

Tokens#

System tokens (5)

Scanned from its CSS at build and checked against its registry entry.

Changelog#

Arrived in 0.1.0.

0.1.024 October 2026

  • Minorreact./sound: the engine (knocks, stamp, pop), the mk:sfx bus, SoundToggle and the four CC0 wood knock clips. Read the whole entry