An interaction representing the release of a Press event on a component.
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-05-15 UTC.
[null,null,["Last updated 2025-05-15 UTC."],[],[],null,["# Interaction\n===========\n\nArtifact: [androidx.compose.foundation:foundation](/jetpack/androidx/releases/compose-foundation) \n[View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/interaction/Interaction.kt+class:androidx.compose.foundation.interaction.Interaction) \nAdded in [1.0.0](/jetpack/androidx/releases/compose-foundation#1.0.0)\nCommon/All\n - Cmn \n\n ```\n interface Interaction\n``` \nKnown direct subclasses \n[DragInteraction](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction), [FocusInteraction](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction), [HoverInteraction](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction), [PressInteraction](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction) \n\n|------------------------------------------------------------------------------------------------|-----------------------------------------|\n| [DragInteraction](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction) | An interaction related to drag events. |\n| [FocusInteraction](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction) | An interaction related to focus events. |\n| [HoverInteraction](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction) | An interaction related to hover events. |\n| [PressInteraction](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction) | An interaction related to press events. |\n\nKnown indirect subclasses \n[DragInteraction.Cancel](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Cancel), [DragInteraction.Start](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start), [DragInteraction.Stop](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Stop), [FocusInteraction.Focus](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus), [FocusInteraction.Unfocus](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Unfocus), [HoverInteraction.Enter](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter), [HoverInteraction.Exit](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Exit), [PressInteraction.Cancel](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Cancel), [PressInteraction.Press](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press), [PressInteraction.Release](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Release) \n\n|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [DragInteraction.Cancel](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Cancel) | An interaction representing the cancellation of a [Start](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start) event on a component. |\n| [DragInteraction.Start](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start) | An interaction representing a drag event on a component. |\n| [DragInteraction.Stop](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Stop) | An interaction representing the stopping of a [Start](/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start) event on a component. |\n| [FocusInteraction.Focus](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus) | An interaction representing a focus event on a component. |\n| [FocusInteraction.Unfocus](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Unfocus) | An interaction representing a [Focus](/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus) event being released on a component. |\n| [HoverInteraction.Enter](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter) | An interaction representing a hover event on a component. |\n| [HoverInteraction.Exit](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Exit) | An interaction representing a [Enter](/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter) event being released on a component. |\n| [PressInteraction.Cancel](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Cancel) | An interaction representing the cancellation of a [Press](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press) event on a component. |\n| [PressInteraction.Press](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press) | An interaction representing a press event on a component. |\n| [PressInteraction.Release](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Release) | An interaction representing the release of a [Press](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press) event on a component. |\n\n*** ** * ** ***\n\nAn 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](/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press). Using Interactions allows you to build components that respond to these transient, component-owned state changes.\n\nTo emit / observe current Interactions, see [MutableInteractionSource](/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource), which represents a stream of Interactions present for a given component. \n\n| See also |\n|----------------------------------------------------------------------------------------------------------------|---|\n| [InteractionSource](/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource) | |\n| [MutableInteractionSource](/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource) | |"]]