Skip to main content
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

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.