Skip to main content

Install from npm

1

Install the package

Install ios-haptics using your preferred package manager.
2

Import the library

Import haptic into your module.
You can also import supportsHaptics if you need to check device support at runtime.
3

Use it

Call haptic() on any user interaction. Use haptic.confirm() for success states and haptic.error() for errors.
ios-haptics is ESM-only ("type": "module" in package.json). Make sure your project supports ES modules before installing.

CDN usage

You can use ios-haptics directly from a CDN without a build step.
Alternatively, use unpkg: