bzzz

Haptic and audio feedback for the web.

haptics.success()

try this on mobile

Installation

npm install bzzz

Usage

Import the singleton and trigger feedback from a user interaction.

import { haptics } from "bzzz";

button.addEventListener("click", () => {
  haptics.success();
});

Types

Five built-in patterns for common interaction feedback.

haptics.success()

Custom patterns

Create isolated instances with your own pattern registry.

import { createHaptics } from "bzzz";

const appHaptics = createHaptics({
  patterns: {
    saveSuccess: [
      { type: "pulse", duration: 20 },
      { type: "gap", duration: 24 },
      { type: "pulse", duration: 80 }
    ]
  }
});

appHaptics.play("saveSuccess");

Fallbacks

The runtime uses native haptics when available and falls back to audio. Every call reports what actually happened.

import { haptics } from "bzzz";

const result = haptics.success();
console.log(result.mode); // "haptics" | "audio" | "none"

const caps = haptics.getCapabilities();
// { haptics: boolean, audio: boolean, ios: boolean, reducedMotion: boolean }