コンテンツにスキップ

@tauri-apps/plugin-haptics

このコンテンツはまだ日本語訳がありません。

Trigger haptic feedback on Android and iOS.

type ImpactFeedbackStyle = "light" | "medium" | "heavy" | "soft" | "rigid";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/bindings.ts#L83

The style of an impact-feedback haptic.

On iOS this maps directly to a UIImpactFeedbackGenerator.FeedbackStyle case. On Android, which has no equivalent system API, each style instead plays a distinct vibration waveform of increasing intensity. Has no effect on desktop platforms. Defaults to Medium.


type NotificationFeedbackType = "success" | "warning" | "error";

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/bindings.ts#L96

The type of notification feedback, indicating the outcome of a task or action.

On iOS this maps directly to a UINotificationFeedbackGenerator.FeedbackType case. On Android, which has no equivalent system API, each type instead plays a distinct vibration waveform. Has no effect on desktop platforms. Defaults to Success.

function impactFeedback(style): Promise<Result<null, never>>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/index.ts#L55

Triggers an impact-feedback haptic, indicating a collision between user interface elements.

On iOS this maps to a UIImpactFeedbackGenerator of the given style. On Android, which has no equivalent system API, each style plays a distinct vibration waveform. Has no effect on desktop platforms.

Parameter Type Description
style ImpactFeedbackStyle The style of the impact.

Promise<Result<null, never>>

A promise resolving to the Result of the operation.

import { impactFeedback } from '@tauri-apps/plugin-haptics'
await impactFeedback('medium')

2.0.0


function notificationFeedback(type): Promise<Result<null, never>>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/index.ts#L78

Triggers a notification-feedback haptic, indicating the outcome of a task or action.

On iOS this maps to a UINotificationFeedbackGenerator of the given type. On Android, which has no equivalent system API, each type plays a distinct vibration waveform. Has no effect on desktop platforms.

Parameter Type Description
type NotificationFeedbackType The outcome to convey.

Promise<Result<null, never>>

A promise resolving to the Result of the operation.

import { notificationFeedback } from '@tauri-apps/plugin-haptics'
await notificationFeedback('success')

2.0.0


function selectionFeedback(): Promise<Result<null, never>>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/index.ts#L98

Triggers a haptic indicating that a selection changed, e.g. the value of a picker control.

Has no effect on desktop platforms.

Promise<Result<null, never>>

A promise resolving to the Result of the operation.

import { selectionFeedback } from '@tauri-apps/plugin-haptics'
await selectionFeedback()

2.0.0


function vibrate(duration): Promise<Result<null, never>>;

Source: https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/haptics/guest-js/index.ts#L34

Triggers a vibration for duration milliseconds.

Has no effect on desktop platforms.

Parameter Type Description
duration number Duration of the vibration, in milliseconds.

Promise<Result<null, never>>

A promise resolving to the Result of the operation.

import { vibrate } from '@tauri-apps/plugin-haptics'
await vibrate(300)

2.0.0


© 2026 Tauri Contributors. CC-BY / MIT