▸ Agent Skills
2 min read

Haptics

GitHubnpmcrates.io

API Reference:

Haptic feedback and vibrations on Android and iOS.

There are no standards/requirements for vibration support on Android, so the feedback APIs may not work correctly on more affordable phones, including recently released ones.

Supported Platforms

This plugin requires a Rust version of at least 1.77.2

[TABLE]

Setup

Install the haptics plugin to get started.

Use your project’s package manager to add the dependency:

npm run tauri add haptics
yarn run tauri add haptics
pnpm tauri add haptics
deno task tauri add haptics
bun tauri add haptics
cargo tauri add haptics
  1. Run the following command in the src-tauri folder to add the plugin to the project’s dependencies in Cargo.toml:

    cargo add tauri-plugin-haptics --target 'cfg(any(target_os = "android", target_os = "ios"))'
  2. Modify lib.rs to initialize the plugin:

    #[cfg_attr(mobile, tauri::mobile_entry_point)]pub fn run() {    tauri::Builder::default()        .setup(|app| {            #[cfg(mobile)]            app.handle().plugin(tauri_plugin_haptics::init());            Ok(())        })        .run(tauri::generate_context!())        .expect("error while running tauri application");}

    src-tauri/src/lib.rs

  3. Install the JavaScript Guest bindings using your preferred JavaScript package manager:

    npm install @tauri-apps/plugin-haptics
    yarn add @tauri-apps/plugin-haptics
    pnpm add @tauri-apps/plugin-haptics
    deno add npm:@tauri-apps/plugin-haptics
    bun add @tauri-apps/plugin-haptics

Usage

The haptics plugin is available in JavaScript.

import {  vibrate,  impactFeedback,  notificationFeedback,  selectionFeedback,} from '@tauri-apps/plugin-haptics';
await vibrate(1);await impactFeedback('medium');await notificationFeedback('warning');await selectionFeedback();

Permissions

By default all potentially dangerous plugin commands and scopes are blocked and cannot be accessed. You must modify the permissions in your capabilities configuration to enable these.

See the Capabilities Overview for more information and the step by step guide to use plugin permissions.

{  "$schema": "../gen/schemas/mobile-schema.json",  "identifier": "mobile-capability",  "windows": ["main"],  "platforms": ["iOS", "android"],  "permissions": [    "haptics:allow-impact-feedback",    "haptics:allow-notification-feedback",    "haptics:allow-selection-feedback",    "haptics:allow-vibrate"  ]}

src-tauri/capabilities/mobile.json

Permission Table

IdentifierDescription
haptics:allow-impact-feedbackEnables the impact_feedback command without any pre-configured scope.
haptics:deny-impact-feedbackDenies the impact_feedback command without any pre-configured scope.
haptics:allow-notification-feedbackEnables the notification_feedback command without any pre-configured scope.
haptics:deny-notification-feedbackDenies the notification_feedback command without any pre-configured scope.
haptics:allow-selection-feedbackEnables the selection_feedback command without any pre-configured scope.
haptics:deny-selection-feedbackDenies the selection_feedback command without any pre-configured scope.
haptics:allow-vibrateEnables the vibrate command without any pre-configured scope.
haptics:deny-vibrateDenies the vibrate command without any pre-configured scope.

Support on Open CollectiveSponsor on GitHub

© 2026 Tauri Contributors. CC-BY / MIT


Last updated Oct 08, 2026