<h2 id="onindirectpointergesture-enabled-onswipeforward-onswipebackward-onclick">onIndirectPointerGesture</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public fun Modifier.onIndirectPointerGesture(
    enabled: Boolean = true,
    onSwipeForward: (() -> Unit)? = null,
    onSwipeBackward: (() -> Unit)? = null,
    onClick: (() -> Unit)? = null,
): Modifier
```

A [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) that detects high-level click and horizontal swipe gestures from an
[IndirectPointerEvent](/jetpack-compose/androidx.compose.ui/ui/interfaces/IndirectPointerEvent) source. The component (or one of its descendants) using this modifier
**must be focused** to intercept events.

This modifier allows optionality for swipe gesture callbacks. If a specific swipe gesture
callback is `null`, the corresponding swipe events will not be consumed by this modifier. For
example:
- When nesting `onIndirectPointerGesture` modifiers, if the inner modifier provides an `onSwipeBackward` callback but leaves `onSwipeForward` as `null`, the outer modifier can still detect and handle the forward swipe, and vice versa.

Note that the initial `down` event is always consumed by this modifier (if not already consumed)
as long as at least one callback ([onClick](/jetpack-compose/androidx.compose.ui/ui/functions/onClick), `onSwipeForward`, or `onSwipeBackward`) is provided.

#### Parameters

| | |
| --- | --- |
| enabled | Controls whether gesture detection is active. When `false`, this modifier has no effect and no callbacks will be invoked. |
| onSwipeForward | Invoked when a successful forward swipe is detected. |
| onSwipeBackward | Invoked when a successful backward swipe is detected. |
| onClick | Invoked when a successful click is detected. |