

The Haptics API provides physical feedback to the user through touch or vibration.
To use vibration, you must add this permission to your AndroidManifest.xml file:
<uses-permission android:name="android.permission.VIBRATE" />import { Plugins, HapticsImpactStyle } from '@capacitor/core';
const { Haptics } = Plugins;
export class HapticsExample {
  hapticsImpact(style = HapticsImpactStyle.Heavy) {
    Haptics.impact({
      style: style,
    });
  }
  hapticsImpactMedium(style) {
    this.hapticsImpact(HapticsImpactStyle.Medium);
  }
  hapticsImpactLight(style) {
    this.hapticsImpact(HapticsImpactStyle.Light);
  }
  hapticsVibrate() {
    Haptics.vibrate();
  }
  hapticsSelectionStart() {
    Haptics.selectionStart();
  }
  hapticsSelectionChanged() {
    Haptics.selectionChanged();
  }
  hapticsSelectionEnd() {
    Haptics.selectionEnd();
  }
}impact(options: HapticsImpactOptions) => voidTrigger a haptics “impact” feedback
| Param | Type | 
|---|---|
| options | HapticsImpactOptions | 
notification(options: HapticsNotificationOptions) => voidTrigger a haptics “notification” feedback
| Param | Type | 
|---|---|
| options | HapticsNotificationOptions | 
vibrate() => voidVibrate the device
selectionStart() => voidTrigger a selection started haptic hint
selectionChanged() => voidTrigger a selection changed haptic hint. If a selection was started already, this will cause the device to provide haptic feedback
selectionEnd() => voidIf selectionStart() was called, selectionEnd() ends the selection. For example, call this when a user has lifted their finger from a control
| Prop | Type | 
|---|---|
| style | HapticsImpactStyle | 
| Prop | Type | 
|---|---|
| type | HapticsNotificationType | 
| Members | Value | 
|---|---|
| Heavy | "HEAVY" | 
| Medium | "MEDIUM" | 
| Light | "LIGHT" | 
| Members | Value | 
|---|---|
| SUCCESS | "SUCCESS" | 
| WARNING | "WARNING" | 
| ERROR | "ERROR" |