Install
git clone https://github.com/zakisheriff/Web-Haptic-Feedback.git cd Web-Haptic-Feedback pnpm install && pnpm build
Local workspace packages. Not yet published to npm.
Usage
import { HapticButton } from "@universal-web-haptics/react";
<HapticButton feedback="success">Tap me</HapticButton>Custom haptic
haptics.trigger([12,35,22])
What is Web Haptic Feedback?
Web Haptic Feedback is an open-source JavaScript and React library for haptic feedback on websites. It uses the Vibration API on Android and a native switch control on iPhone Safari 17.4+, so a tap produces system feedback.
Frequently asked questions
Yes, on iOS and iPadOS Safari 17.4 or later. Safari has no Vibration API, so a native switch control sits under your finger; toggling it makes iOS play system feedback. Reduced Motion must be off.
Yes. On Android browsers that expose navigator.vibrate, such as Chrome, patterns are sent through the Vibration API.
Use the HapticButton component or the haptics.trigger() function from the core package. Call it directly from a click or tap handler so iOS accepts it.
Yes. It is MIT licensed and open source on GitHub. The packages are currently installed from source and are not yet on npm.
No. No web API reports physical output, so results are reported as requested, unsupported or blocked, never as verified.