Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tijnjh/ios-haptics/llms.txt
Use this file to discover all available pages before exploring further.
supportsHaptics is a boolean constant exported from ios-haptics. It is true on touch-pointer devices (coarse pointer) and false otherwise.
Import
How it works
supportsHaptics uses window.matchMedia("(pointer: coarse)") to detect whether the primary pointer device is a touchscreen. In SSR and other non-browser environments where typeof window === "undefined", it returns false.
The exact source logic:
Usage
haptic() checks supportsHaptics internally (after first checking navigator.vibrate), so calls on unsupported devices are silently no-ops. You only need to read supportsHaptics yourself if you want to conditionally show or hide UI based on haptic support.Return value
boolean — true if the device has a coarse pointer (i.e., touchscreen), false otherwise.