TapTickit Docs

Svelte

Import createTaptic from taptickit/svelte. Unlike React/Vue hooks, this returns an object with an explicit destroy() — call it when the store or component is torn down if you create the instance yourself.

Basic usage

<script lang="ts">
  import { createTaptic } from "taptickit/svelte";

  const { trigger, cancel, destroy, isSupported } = createTaptic();

  // In Svelte 5 / runes you might destroy in an $effect cleanup;
  // in Svelte 4, use onDestroy(() => destroy()).
</script>

<button type="button" on:click={() => trigger("light")}>Light tap</button>

Options

createTaptic(options?) passes TapticKitOptions to the constructor once. Use setDebug(boolean) on the returned object to toggle debug after creation.

Returns

PropertyTypeDescription
trigger(input?, options?) => Promise<void>TapticKit.trigger
cancel() => voidTapticKit.cancel
destroy() => voidTapticKit.destroy
setDebug(debug: boolean) => voidTapticKit.setDebug
isSupportedbooleanTapticKit.isSupported