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 is a tiny JavaScript library that triggers native haptic feedback in Safari on iOS. It uses the <input type="checkbox" switch /> element introduced in Safari 17.4 to fire the Taptic Engine — no native APIs, no permissions, no polyfills needed. On Android it falls back to navigator.vibrate().

Installation

Install from npm in seconds with your preferred package manager.

Quickstart

Trigger your first haptic in under a minute.

API Reference

Full documentation for haptic() and supportsHaptics.

How It Works

Understand the Safari switch-input trick under the hood.

Quick example

import { haptic } from 'ios-haptics'

// Single tap
haptic()

// Double tap — for confirmations
haptic.confirm()

// Triple tap — for errors
haptic.error()

Why ios-haptics?

Zero dependencies

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

iOS Safari native feel

Fires the Taptic Engine via the checkbox switch trick — feels like a native app.

Android fallback

Automatically uses navigator.vibrate() on devices that support it.

TypeScript first

Ships with full type definitions and clean IntelliSense support.

Build docs developers (and LLMs) love