Button with haptic feedback
- Vanilla JS
- React
Form submission
Usehaptic.confirm() on successful submission and haptic.error() when validation fails.
React example
A React component that fires haptics based on the outcome of an async operation.Conditional haptic UI
UsesupportsHaptics to render a UI hint only on devices that will actually fire haptics.
Swipe gesture
Callhaptic() inside a touch event handler to add tactile feedback to swipe interactions.