Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 1.73 KB

README.md

File metadata and controls

74 lines (55 loc) · 1.73 KB

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