---
title: "PointerInputEventHandler"
description: "Create a modifier for processing pointer input within the region of the modified element."
type: "interface"
---
## API Reference

> Source set: Common

```kotlin
public interface PointerInputEventHandler
```

Create a modifier for processing pointer input within the region of the modified element.

[pointerInput](/jetpack-compose/androidx.compose.ui/ui/modifiers/pointerInput/api) `block`s may call `PointerInputScope.awaitPointerEventScope` to install a pointer
input handler that can `AwaitPointerEventScope.awaitPointerEvent` to receive and consume pointer
input events. Extension functions on [PointerInputScope](/jetpack-compose/androidx.compose.ui/ui/interfaces/PointerInputScope/api) or [AwaitPointerEventScope](/jetpack-compose/androidx.compose.ui/ui/interfaces/AwaitPointerEventScope/api) may be
defined to perform higher-level gesture detection. The pointer input handling `block` will be
cancelled and **re-started** when [pointerInput](/jetpack-compose/androidx.compose.ui/ui/modifiers/pointerInput/api) is recomposed with any different `keys` or the
`block` class is different.

When a [pointerInput](/jetpack-compose/androidx.compose.ui/ui/modifiers/pointerInput/api) modifier is created by composition, if `block` captures any local variables
to operate on, two patterns are common for working with changes to those variables depending on
the desired behavior.

Specifying the captured value as a [key](/jetpack-compose/androidx.compose.ui/ui/properties/key/api) parameter will cause `block` to cancel and restart
from the beginning if the value changes:

If `block` should **not** restart when a captured value is changed but the value should still be
updated for its next use, use
`rememberUpdatedState` to update a value holder
that is accessed by `block`:

***Note*** Any removal operations on Android Views from `pointerInput` should wrap the `block` in
a `post { }` block to guarantee the event dispatch completes before executing the removal. (You
do not need to do this when removing a composable because Compose guarantees it completes via the
snapshot state system.)
/
public fun Modifier.pointerInput(vararg keys: Any?, block: PointerInputEventHandler): Modifier =
this then SuspendPointerInputElement(keys = keys, pointerInputEventHandler = block)

/*
Represents the 'block' lambda passed into `Modifier.pointerInput`. It's used to receive and
consume pointer input events.

## Functions

### invoke

> Source set: Common

```kotlin
public suspend operator fun PointerInputScope.invoke()
```

## Code Examples

### keyedPointerInputModifier

```kotlin
@Sampled
fun keyedPointerInputModifier() {
```

### rememberedUpdatedParameterPointerInputModifier

```kotlin
@Sampled
fun rememberedUpdatedParameterPointerInputModifier() {
```
