TapTickit drives haptic-style feedback on capable phones using navigator.vibrate, with optional desktop debug behavior (audio + synthetic UI) when vibration is unavailable or debug is enabled.
Call trigger from a user gesture (click / tap). Browsers gate vibration to active user interaction.
"use client";
import { useTaptic } from "taptickit/react";
export function Example() {
const { trigger, isSupported } = useTaptic();
return (
<button type="button" onClick={() => trigger("success")}>
{isSupported ? "Success haptic" : "No vibration API"}
</button>
);
}
<script setup>
import { useTaptic } from "taptickit/vue";
const { trigger, isSupported } = useTaptic();
</script>
<template>
<button type="button" @click="trigger('success')">
{{ isSupported ? "Success haptic" : "No vibration API" }}
</button>
</template>
<script>
import { createTaptic } from "taptickit/svelte";
const { trigger, isSupported } = createTaptic();
</script>
<button type="button" on:click={() => trigger("success")}>
{isSupported ? "Success haptic" : "No vibration API"}
</button>
import { TapticKit } from "taptickit";
const haptic = new TapticKit();
document.querySelector("button")?.addEventListener("click", () => {
haptic.trigger("success");
});
"light", "medium", "heavy", "success", "warning", "error", "selection", and more (see Built-in presets).[on, off, on, …] or full Vibration objects.haptic.trigger("selection");
haptic.trigger(40);
haptic.trigger([10, 50, 20]);
TapticKit, hooks & stores"use client": Next.js & SSR