useLongPress

Run a callback when an element is pressed and held, with mouse or touch.

This is custom React hooks, you need to follow the Basic Rules when you use it.

General

Hold the button for one second.

APIs

useLongPress

const useLongPress = (
  onLongPress: () => void,
  options?: { threshold?: number },
) => {
  onMouseDown: () => void
  onMouseUp: () => void
  onMouseLeave: () => void
  onTouchStart: () => void
  onTouchEnd: () => void
}
Edit this page on GitHub