# Introduction

[![codecov](https://codecov.io/gh/minwork/react/branch/main/graph/badge.svg?token=2KPMMSLDOM)](https://codecov.io/gh/minwork/react) ![npm type definitions](https://img.shields.io/npm/types/use-long-press) ![npm bundle size](https://img.shields.io/bundlephobia/min/use-long-press) [![npm](https://img.shields.io/npm/v/use-long-press)](https://www.npmjs.com/package/use-long-press)

<figure><img src="https://1041512627-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe7YSKGn5OVHfSXruihOD%2Fuploads%2FHAHZgfHfGzIEfXDf4rQH%2FReact%20Long%20Press%20Hook.webp?alt=media&#x26;token=810d106f-d7e4-41ff-b4d6-4e51ab89725a" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
React hook for detecting *click* / *tap* / *point* and *hold* event
{% endhint %}

## 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
* 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 [context](https://minwork.gitbook.io/long-press-hook/advanced/hook-result-bind-function/context).
* Handle custom long press (you can manually attach different handlers to different React components). For more info see [handlers](https://minwork.gitbook.io/long-press-hook/advanced/hook-result-bind-function/handlers).

## What it does not

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://minwork.gitbook.io/long-press-hook/introduction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
