---
title: "performTrackpadInput"
description: "Executes the trackpad gesture specified in the given [block]. The gesture doesn't need to be
complete and can be resumed in a later invocation of one of the `perform.*Input` methods. The
event time is initialized to the current time of the [MainTestClock].

Be aware that if you split a gesture over multiple invocations of `perform.*Input`, everything
that happens in between will run as if the gesture is still ongoing (imagine a trackpad button
still being pressed).

All events that are injected from the [block] are batched together and sent after [block] is
complete. This method blocks while the events are injected. If an error occurs during execution
of [block] or injection of the events, all (subsequent) events are dropped and the error is
thrown here.

Due to the batching of events, all events in a block are sent together and no recomposition will
take place in between events. Additionally all events will be generated before any of the events
take effect. This means that the screen coordinates of all events are resolved before any of the
events can cause the position of the node being injected into to change. This has certain
advantages, for example, in the cases of nested scrolling or dragging an element around, it
prevents the injection of events into a moving target since all events are enqueued before any of
them has taken effect.

Example of performing a trackpad click:"
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun SemanticsNodeInteraction.performTrackpadInput(
    block: TrackpadInjectionScope.() -> Unit
): SemanticsNodeInteraction
```


Executes the trackpad gesture specified in the given `block`. The gesture doesn't need to be
complete and can be resumed in a later invocation of one of the `perform.*Input` methods. The
event time is initialized to the current time of the `MainTestClock`.

Be aware that if you split a gesture over multiple invocations of `perform.*Input`, everything
that happens in between will run as if the gesture is still ongoing (imagine a trackpad button
still being pressed).

All events that are injected from the `block` are batched together and sent after `block` is
complete. This method blocks while the events are injected. If an error occurs during execution
of `block` or injection of the events, all (subsequent) events are dropped and the error is
thrown here.

Due to the batching of events, all events in a block are sent together and no recomposition will
take place in between events. Additionally all events will be generated before any of the events
take effect. This means that the screen coordinates of all events are resolved before any of the
events can cause the position of the node being injected into to change. This has certain
advantages, for example, in the cases of nested scrolling or dragging an element around, it
prevents the injection of events into a moving target since all events are enqueued before any of
them has taken effect.

Example of performing a trackpad click:

#### Parameters

| | |
| --- | --- |
| block | A lambda with `TrackpadInjectionScope` as receiver that describes the gesture by sending all trackpad events. |


#### Returns

| | |
| --- | --- |
|  | The `SemanticsNodeInteraction` that is the receiver of this method |




## Code Examples
### trackpadInputClick
```kotlin
fun trackpadInputClick() {
    composeTestRule.onNodeWithTag("myComponent").performTrackpadInput {
        // Click in the middle of the node
        click(center)
    }
}
```

