TapTickit Docs

Vanilla JS

The core class TapticKit is exported from the root package taptickit. Use it anywhere you can run browser JavaScript (bundlers, inline modules, etc.).

Basic usage

import { TapticKit } from "taptickit";

const haptic = new TapticKit();

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

Shared exports

From taptickit you can also import:

  • defaultPatterns — preset definitions (same keys as string presets in trigger)
  • TypesVibration, HapticPattern, HapticPreset, HapticInput, TriggerOptions, TapticKitOptions
  • version — package version string

Lifecycle

Call destroy() when you no longer need the instance (for example when leaving a SPA view) to remove DOM nodes and release audio resources used in debug mode.

haptic.destroy();

Support check

Use the static flag before changing UI:

if (TapticKit.isSupported) {
  // show haptic affordances
}

See TapticKit for the full method list.