useVibration

Hook

Wraps the Vibration API for haptic feedback on mobile devices. Accepts a single duration or a pattern array. Falls back silently on desktop.

core/use-vibration

Installation

1 · Add registry to components.json

2 · Install component

Examples

Haptic feedback

Triggers device vibration on supported mobile browsers.

API Reference

PropTypeDescription
isSupported
booleanWhether the Vibration API is available.
vibrate
(pattern: number | number[]) => voidTrigger vibration with a duration (ms) or pattern.
stop
() => voidStop any active vibration.