Skip to content

A convenient React hook that utilizes input[switch] introduced in Safari 18.0 to trigger haptic feedback anytime, anywhere in your application.

License

Notifications You must be signed in to change notification settings

posaune0423/use-haptic

Repository files navigation

use-haptic 📳

CI npm package downloads types included

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 !!!!! 👈🏻

Features

  • Trigger haptic feedback at any time in your React application
  • Simple API

Install

npm install use-haptic
yarn add use-haptic
pnpm add use-haptic
bun add use-haptic

Quick start

git clone https://github.com/posaune0423/use-haptic.git
cd sample
npm install
npm run dev

And then, access the ip address displayed in the console by your iPhone.

> npm run dev

> [email protected] dev
> vite --host

Port 5173 is in use, trying another one...

VITE v5.4.6 ready in 102 ms

➜ Local: http://localhost:5174/
➜ Network: http://192.xxx.xx.xxx:5174/
➜ press h + enter to show help

Usage

import { useHaptic } from "use-haptic";

function VibrationButton() {
  const { vibe } = useHaptic();
  return <button onClick={vibe}>Vibe</button>;
}

License

MIT

About

A convenient React hook that utilizes input[switch] introduced in Safari 18.0 to trigger haptic feedback anytime, anywhere in your application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published