Reference
Haptics API
Impact, notification, and selection feedback.
Native enablement is internalPlugins.haptics. The dependency is @capacitor/haptics@8.0.2. No runtime permission prompt is required.
| Client export | Arguments | Result |
|---|---|---|
hapticImpact(style?) | "LIGHT", "MEDIUM", or "HEAVY". Default "MEDIUM". | Effect of void |
hapticNotification(type) | "SUCCESS", "WARNING", or "ERROR" | Effect of void |
hapticSelection | Effect value with no arguments | Effect of void |
These Effects require Bridge | BrowserHaptics. hapticsLive(effect) supplies BrowserHapticsLive. BrowserHaptics provides injectable vibrate(pattern) behavior. ImpactStyleSchema and NotificationTypeSchema validate inputs. Their types are ImpactStyle and NotificationType.
| Browser result | Behavior |
|---|---|
| Vibration available | Approximate patterns |
Missing API or vibrate returns false | Successful no-op |
| Exception | HapticFeedbackFailed with cause |
| Hardware support | Success does not prove vibration; also applies to native devices |
| Error | Meaning |
|---|---|
BridgeError | Transport or schema failure; invalid style or notification input produces BridgeDecodeError |
HapticFeedbackFailed | Browser vibration exception; carries cause |
useHapticFeedback() exposes light, medium, heavy, success, warning, error, selection, and impact, plus action state. The failure field is failure; error() is an action. A completed action sets value to true.
Platform support
| Capability | Android | iOS | Browser |
|---|---|---|---|
| Feedback | Native haptics | Native haptics | Vibration API or successful no-op |
Source: haptics implementation.