Skip to main content

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.

Install from npm

1

Install the package

Install ios-haptics using your preferred package manager.
npm install ios-haptics
2

Import the library

Import haptic into your module.
import { haptic } from 'ios-haptics'
You can also import supportsHaptics if you need to check device support at runtime.
import { haptic, supportsHaptics } from 'ios-haptics'
3

Use it

Call haptic() on any user interaction. Use haptic.confirm() for success states and haptic.error() for errors.
// Single tap — general feedback
haptic()

// Double tap — confirmation
haptic.confirm()

// Triple tap — error
haptic.error()
ios-haptics is ESM-only ("type": "module" in package.json). Make sure your project supports ES modules before installing.

CDN usage

You can use ios-haptics directly from a CDN without a build step.
<script type="module">
  import { haptic } from 'https://esm.sh/ios-haptics'

  document.querySelector('button').addEventListener('click', () => {
    haptic()
  })
</script>
Alternatively, use unpkg:
<script type="module">
  import { haptic } from 'https://unpkg.com/ios-haptics/dist/index.js'

  document.querySelector('button').addEventListener('click', () => {
    haptic()
  })
</script>

Build docs developers (and LLMs) love