Add haptic feedback to your web app
Paste a component or list your interactions. See which vibration each button, toggle and form should fire, feel it, and copy the code.
- Free, no sign-up
- Nothing uploaded
- React, Vue, Svelte, HTML
No code handy? Try one:
Have a .jsx, .tsx, .vue, .svelte or .html file?
How it works
- Paste a component. JSX or TSX, a Vue or Svelte file, or plain HTML. The page finds buttons, switches and checkboxes, selects and radios, sliders, steppers, tabs, forms, drag and drop, long presses, pull-to-refresh and swipes. No code yet? List the interactions one per line: "Delete account", "Volume slider", "Payment declined".
- Read the plan. Each control gets one haptic from Apple's table: outcomes (saved, paid, failed) fire success or error when the result arrives; a delete warns before the confirmation; toggles are light; pickers, sliders, steppers and tabs tick with selection; a drop lands medium; a long press is heavy. Links and text fields get none.
- Feel it. Press Feel on a phone. Android vibrates; iPhone ticks through the same switch trick the web-haptics library uses. A computer cannot vibrate, so the button pulses on screen, with a click sound if you turn it on.
- Copy the code. For React, Vue, Svelte or plain JavaScript with the web-haptics library, or bare navigator.vibrate() arrays if you want no dependency. Each call says which line it belongs to.
- Read the checks. Haptics on page load or scroll, long continuous vibrations, an "error" outside an error path and too many haptics are flagged.
Questions
- Does web haptic feedback work on iPhone?
- Safari on iPhone has no navigator.vibrate(). The web-haptics library works around it with a hidden switch control that gives a short tick each time it toggles, so the presets still play as ticks. The code this page writes uses that library unless you pick navigator.vibrate.
- Which haptic should a button fire?
- A primary button press is medium and a secondary button light. A button that saves, sends or pays fires success when the result arrives, or error if it fails, not on the tap. A delete button fires warning before the confirmation.
- Can there be too many haptics?
- Yes. If every tap vibrates, nothing feels special. Keep haptics for moments with a physical consequence, never on page load or while scrolling, and always pair them with a visible change. "Key moments only" drops plain button taps, tabs and modals.
- What do the numbers in navigator.vibrate mean?
- Milliseconds on, off, on, off. Phones cannot set vibration strength from a web page, so web-haptics fakes intensity by pulsing the motor in 20 ms cycles: a softer haptic is more off than on. The arrays this page writes are exactly what the library sends.
- Is my code uploaded?
- No. The plan and the code are made inside your browser tab. Only the optional AI review sends the code and the plan, and only when you press its button.