onTapGesture runs on a single (or multi-) tap; onDragGesture reports drag translation and velocity through every phase; onLongPressGesture fires after a press-and-hold; onHover tracks pointer enter/leave on web and desktop.
For interactive controls, prefer Button directly — gesture modifiers are best for adding handling to otherwise non-interactive components like Text, Image, and shapes.
onTapGesture
Runs an action when the component is tapped.A callback that receives the tap location as a
Point ({ x, y }) in the component’s coordinate space.Configuration options for the tap gesture.
locationInView is in the tapped component’s local coordinate space, with { x: 0, y: 0 } at the top-leading corner. When combining single and multi-tap gestures, apply the higher count gesture first — the system waits briefly to distinguish between single and multi-tap. For interactive controls like buttons, prefer using Button directly.
onDragGesture
Tracks drag gestures with translation and velocity.A callback that receives the drag gesture state throughout the gesture lifecycle.
Configuration options for the drag gesture.
"possible", "began", "changed", "ended", and "cancelled". translation is cumulative from the initial touch point, not a per-frame delta. velocity is in points per second and is useful for flick/swipe detection.
onLongPressGesture
Tracks long press gestures.A callback that receives the gesture state throughout the gesture lifecycle.
Configuration options for the long press gesture.
"possible", "began", "changed", "ended", and "cancelled". Use "began" and "changed" to show press-in-progress feedback, and "ended" to perform the action. If the finger moves beyond maximumDistance, the gesture is cancelled.
onHover
Fires when the pointer hovers over or leaves the component.A callback that receives
true when the pointer enters the component and false when it leaves.See also
- Button — interactive control with built-in tap handling
- contextMenu — show a menu on long press or right-click
- allowsHitTesting — control whether a component receives events
- contentShape — define the hit-testing region