Long press hook
  • Introduction
  • Installation
  • Basics
  • Advanced
    • Definition
    • Callback
    • Options
      • Configuration
        • Events detection
        • Long press threshold
      • React events
        • Persisting event
        • Filtering events
      • Callbacks
        • Press started
        • On move
        • Press finished
        • Long press cancelled
      • Cancellation
        • Cancel outside element
        • Cancel on movement
    • Hook result / Bind function
      • Context
      • Handlers
  • Examples
    • Advanced usage example
    • Live examples
      • Version 3
      • Version 2 (deprecated)
      • Version 1 (deprecated)
  • Migration
    • V1 to V2
    • V2 to V3
    • ⚠️V3.1+
    • Change log
  • Contributions
    • ❤️Donations
    • Pull requests policy
  • Architectural Decisions
    • V1 and V2 deprecation
    • Moving to new repository
Powered by GitBook
On this page
  • Main features
  • What it does
  • What it does not

Was this helpful?

Introduction

About long press hook

NextInstallation

Last updated 8 months ago

Was this helpful?

React hook for detecting click / tap / point and hold event

Main features

  • Mouse, Touch and Pointer events support

  • Pass custom context and access it in callback

  • Cancel long press if moved too far from the target

  • Flexible callbacks: onStart, onMove, onFinish, onCancel

  • Disable hook when necessary

  • Filter undesired events (like mouse right clicks)

What it does

  • Handle long press on single React component

What it does not

  • It does not prevent browser specific behaviour on long press. Most of them can be handled using CSS.

Handle long press on multiple React components (e.g. list of elements where you can provide element id as hook context to distinguish which element triggered long press). For more info see .

Handle custom long press (you can manually attach different handlers to different React components). For more info see .

context
handlers
codecov
npm bundle size
npm type definitions
npm