Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tijnjh/ios-haptics/llms.txt

Use this file to discover all available pages before exploring further.

ios-haptics triggers native haptic feedback in Safari on iOS using the <input type="checkbox" switch /> element introduced in Safari 17.4. It fires the Taptic Engine directly — no native APIs, no permissions, no polyfills. On Android it falls back to navigator.vibrate() automatically.

Key features

haptic()

Triggers a single tap — the default haptic feedback for any interaction.

haptic.confirm()

Triggers a double tap, ideal for confirming successful actions.

haptic.error()

Triggers a triple tap to signal errors or destructive actions.

supportsHaptics

A boolean you can read at runtime to detect whether the device supports haptics.

iOS Safari support

Works on Safari 17.4+ using the checkbox switch trick to access the Taptic Engine.

Android fallback

Automatically falls back to navigator.vibrate() on supported Android browsers.

Zero dependencies

The entire library is a single TypeScript file with no runtime dependencies.

TypeScript first

Ships with full type definitions and clean IntelliSense support out of the box.
Haptic feedback requires iOS Safari 17.4 or later, or a browser that supports navigator.vibrate(). On desktop browsers and simulators, calls are silently ignored.

Get started

Installation

Install ios-haptics from npm using your preferred package manager.

Quickstart

Trigger your first haptic in under a minute.

Build docs developers (and LLMs) love