onPress

Handles every pointer press that hits this modifier's laid-out bounds.

Return

this chain with one appended active press handler.

Parameters

callback

callback receiving the typed event and modifier-local position and deciding propagation.

Throws

when callback fails during dispatch.


fun Modifier.onPress(action: () -> Unit): Modifier(source)

Runs action for every primary pointer press that hits this modifier and consumes the event. Other button presses remain ignored so lower or earlier handlers can process them.

Return

this chain with one appended consuming press handler.

Parameters

action

synchronous action invoked on the owning tree thread.

Throws

when action fails during dispatch.