- Android
- iOS
- Web
Haptics
Play tactile feedback where the platform supports it.
Quick start
nayan-ui/haptics
import { haptics } from 'nayan-ui/haptics';
export function confirmSelection() {
if (haptics.supported) haptics.notify('success');
}Distinguish selection, impact, and completion
nayan-ui/haptics
import { haptics } from 'nayan-ui/haptics';
export function feedback(event: 'selection' | 'impact' | 'complete') {
if (!haptics.supported || !haptics.enabled) return;
if (event === 'selection') haptics.selection();
else if (event === 'impact') haptics.impact(0.5, 0.65);
else haptics.notify('success');
}Play a custom two-tap pattern
nayan-ui/haptics
import { haptics } from 'nayan-ui/haptics';
export function doubleTap() {
if (!haptics.supported) return;
haptics.play([
{ time: 0, intensity: 0.35, sharpness: 0.4 },
{ time: 0.12, intensity: 0.65, sharpness: 0.7 }
]);
}