Haptic Feedback
Trigger haptic feedback on mobile devices.
Loading…
Features
- Uses Vibration API on Android and iOS checkbox trick on iOS.
- Supports custom duration and vibration patterns on Android devices.
- The haptic functionality was inspired by the Vercel mobile experience.
Installation
Add the registry
Skip if already installed
$ pnpm dlx shadcn@latest registry add @carlos-dubon=https://carlosdubon.dev/r/{name}.json
Add the component
$ pnpm dlx shadcn@latest add @carlos-dubon/haptic
Usage
import { haptic } from "@/lib/haptic"<Button onClick={() => haptic()}>Haptic</Button>Haptic feedback should not be used arbitrarily. For best practices, please refer to Apple's Human Interface Guidelines on Playing haptics.
API Reference
Prop
Type