use-long-press (master) doxdox documentation

React hook for detecting click (or tap) and hold event. Easy to use, highly customizable options, thoroughly tested.

# useLongPress(callback, options)

Detect click / tap and hold event


Name Types Description

Function to call when long press event is detected (click or tap lasts for threshold amount of time or longer)

  • threshold - Period of time that must elapse after detecting click or tap in order to trigger callback
  • captureEvent - If React Event will be supplied as first argument to all callbacks
  • detect - Which type of events should be detected ('mouse'