Better Stack
jollycoding's profile
James@jollycoding•Mar 03
1.5K

The NPM Package Everyone Is Adding To Their Site (Web Haptics)

From youtube.com•Mar 03•4m watch time

The web-haptics npm package enables haptic feedback on websites for both Android and iOS devices, making web apps feel more native. It exposes a simple React hook (useWebHaptics) with trigger, cancel, and isSupported utilities. Android support uses the standard navigator.vibrate API, while iOS support is achieved via a clever workaround: programmatically toggling an invisible checkbox input of type switch, which natively triggers haptic feedback on iOS. Custom vibration patterns can be defined with delay, duration, and intensity values, or chosen from built-in presets. A visual editor on the package's website helps design and preview custom patterns.

Sort:

jollycoding's user avatar
James
@jollycoding
Joined Nov 21. 2024
1.5K

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard