androidx.compose.foundation.interaction

Interaction

Interface · from org.jetbrains.compose.foundation:foundation:1.12.2

No hand-written docs yet.

An Interaction represents transient UI state for a component, typically separate from the actual 'business' state that a component may control. For example, a button typically fires an onClick callback when the button is pressed and released, but it may still want to show that it is being pressed before this callback is fired. This transient state is represented by an Interaction, in this case PressInteraction.Press. Using Interactions allows you to build components that respond to these transient, component-owned state changes.

interface Interaction

Kinds of Interaction

Anywhere a Interaction is expected, you can pass any of these.

How to get one

Or create one of the kinds listed above.

Used by

Parameters that take a Interaction.

Library docs

An Interaction represents transient UI state for a component, typically separate from the actual 'business' state that a component may control. For example, a button typically fires an onClick callback when the button is pressed and released, but it may still want to show that it is being pressed before this callback is fired. This transient state is represented by an Interaction, in this case PressInteraction.Press. Using Interactions allows you to build components that respond to these transient, component-owned state changes.

To emit / observe current Interactions, see MutableInteractionSource, which represents a stream of Interactions present for a given component.