> For the complete documentation index, see [llms.txt](https://minwork.gitbook.io/long-press-hook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://minwork.gitbook.io/long-press-hook/introduction.md).

# 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="/files/Q5KEUsrj87e1aS5gwpFP" 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](/long-press-hook/advanced/hook-result-bind-function/context.md).
* Handle custom long press (you can manually attach different handlers to different React components). For more info see [handlers](/long-press-hook/advanced/hook-result-bind-function/handlers.md).

## What it does not

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.
