
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-haptic
Advanced tools

Lightweight | Cross-Platform | iOS-Like Haptics
A lightweight React Hook that mimics iOS-style haptic feedback. On devices supporting the Vibrate API, it directly triggers vibration. On iOS devices—where navigator.vibrate is generally unavailable—it leverages a hidden switch trick to produce Taptic-like feedback, similar to native iOS haptic interactions.
Use your favorite package manager to install:
# npm
npm install react-haptic
# yarn
yarn add react-haptic
# pnpm
pnpm add react-haptic
import React from "react";
import { useHaptic } from "react-haptic";
const Component = () => {
const { vibrate } = useHaptic();
const handleClick = () => {
vibrate(); // Trigger haptic feedback
};
return <button onClick={handleClick}>Click for Haptic</button>;
};
iOS devices Falls back to clicking a hidden switch element, which can trigger Taptic feedback in many iOS browsers.
Non-iOS devices
If navigator.vibrate is available, the device vibrates for the specified duration (default: 100ms).
Note iOS 16+ provides an experimental “Haptics API” behind a Safari flag. Until it's widely enabled, this library uses the hidden switch trick as a workaround.
useHaptic(options?: UseHapticOptions)| Name | Type | Default | Description |
|---|---|---|---|
options | UseHapticOptions | - | Optional configuration object. |
options.hapticDuration | number | 100 | The duration (in milliseconds) for the vibration, if the Vibrate API is supported. |
| Name | Type | Description |
|---|---|---|
vibrate | () => void | A function that triggers haptic feedback (vibration or Taptic-like feedback). |
FAQs
React hooks for haptic feedback
We found that react-haptic demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.