触感反馈
在移动设备上触发触感反馈。
Loading…
特性
- 在 Android 上使用 Vibration API,在 iOS 上使用 checkbox 技巧。
- 支持在 Android 设备上自定义持续时间和振动模式。
- 触感功能灵感来自 Vercel 的移动端体验。
安装
$ pnpm dlx shadcn@latest add @ncdai/haptic
用法
import { haptic } from "@/lib/haptic"<Button onClick={() => haptic()}>Haptic</Button>触感反馈不应随意使用。关于最佳实践,请参阅 Apple 人机界面指南中的播放触感。
API 参考
Prop
Type
