Gathering detailed insights and metrics for tauri-plugin-macos-haptics-api
Gathering detailed insights and metrics for tauri-plugin-macos-haptics-api
Gathering detailed insights and metrics for tauri-plugin-macos-haptics-api
Gathering detailed insights and metrics for tauri-plugin-macos-haptics-api
Utilize the Taptic Engine (TM) on macOS for Tauri v2 apps.
npm install tauri-plugin-macos-haptics-api
Typescript
Module System
Node Version
NPM Version
70.2
Supply Chain
98.8
Quality
76.9
Maintenance
100
Vulnerability
99.6
License
Rust (47%)
TypeScript (46.7%)
JavaScript (5.22%)
CSS (1.09%)
Total Downloads
199
Last Day
1
Last Week
2
Last Month
23
Last Year
199
MIT License
6 Stars
15 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Jun 18, 2025
Minified
Minified + Gzipped
Latest Version
1.0.0
Package Id
tauri-plugin-macos-haptics-api@1.0.0
Unpacked Size
12.98 kB
Size
3.70 kB
File Count
6
NPM Version
10.7.0
Node Version
20.15.1
Published on
Oct 03, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-66.7%
2
Compared to previous week
Last Month
155.6%
23
Compared to previous month
Last Year
0%
199
Compared to previous year
1
4
Utilize the Taptic Engine™️ on macOS for Tauri v2 apps.
Using the command line from crates.io:
$ cargo add tauri-plugin-macos-haptics
Or add it manually to Cargo.toml
:
1[target.'cfg(target_os = "macos")'.dependencies] 2tauri-plugin-macos-haptics = "1.0.0"
Note: if you want to include this only on macOS, put
Or get the latest using git:
1[target.'cfg(target_os = "macos")'.dependencies] 2tauri-plugin-macos-haptics = { git = "https://github.com/ItsEeleeya/tauri-plugin-macos-haptics/" }
pnpm add tauri-plugin-macos-haptics-api
# or
bun add tauri-plugin-macos-haptics-api
# or
npm add tauri-plugin-macos-haptics-api
# or
yarn add tauri-plugin-macos-haptics-api
1. First initialize the plugin
This is only needed if you want to use it from the frontend.
1fn main() { 2 let mut builder = tauri::Builder::default(); 3 4 #[cfg(target_os = "macos")] 5 { 6 // You can safely init the plugin on any platform. 7 // Or choose to only initialize it on macos. 8 builder = builder.plugin(tauri_plugin_macos_haptics::init()); 9 } 10 11 builder 12 .run(tauri::generate_context!()) 13 .expect("error while running tauri application"); 14}
2. Permissions
Add "macos-haptics:default"
to your permissions.
Usually found under src-tauri/capabilities/*.json
Read more about the specific permissions.
3. Perform a haptic feedback
From Rust:
1 use tauri_plugin_macos_haptics::haptics::*; 2 3 fn provide_feedback() { 4 #[cfg(target_os = "macos")] 5 { 6 use tauri_plugin_macos_haptics::haptics::*; 7 NSHapticFeedbackManager::default_performer().perform(NSHapticFeedbackPattern::Generic, None).ok(); 8 } 9 }
From the frontend (Typescript):
1import { 2 isSupported, 3 perform, 4 HapticFeedbackPattern, 5 PerformanceTime, 6} from "tauri-plugin-macos-haptics-api"; 7 8if (await isSupported()) { 9 perform(HapticFeedbackPattern.LevelChange, PerformanceTime.Now); 10 // Or call the function with no arguments to default to Generic and now. 11}
⚠️ Please note that you should trigger a feedback ONLY in response to user-initiated actions. Ideally, visual feedback, such as a highlight or appearance of an alignment guide, should accompany the feedback.
In some cases, the system may override a call to this method. For example, a Force Touch trackpad won’t provide haptic feedback if the user isn’t touching the trackpad.
Haptic feedback is intended to be provided in response to a user action, such as aligning one object to another. Do not use it to provide feedback for events that are not user initiated. Excessive or unnecessary haptic feedback could be interpreted by the user as a malfunction and could encourage the user to disable haptic feedback entirely.
Learn more about NSHapticFeedbackManager (Apple's documentation)
Any contributions are welcomed!
No vulnerabilities found.
No security vulnerabilities found.