A convenient React hook that utilizes input[switch]
introduced in Safari 18.0 to trigger haptic feedback anytime, anywhere in your application.
Try Demo here !!!!! 👈🏻
- Trigger haptic feedback at any time in your React application
- Simple API
npm install use-haptic
git clone https://github.com/posaune0423/use-haptic.git
cd sample
deno task dev
And you can visit the demo page by scanning the QR code displayed in the terminal.
import { useHaptic } from 'use-haptic'
function VibrationButton() {
const { vibe } = useHaptic()
return <button onClick={vibe}>Vibe</button>
}