# Interaction

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/interaction/Interaction.kt+class:androidx.compose.foundation.interaction.Interaction) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0) Common/All
- Cmn

  ```
  interface Interaction
  ```
Known direct subclasses [DragInteraction](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction), [FocusInteraction](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction), [HoverInteraction](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction), [PressInteraction](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction` | An interaction related to drag events. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction` | An interaction related to focus events. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction` | An interaction related to hover events. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction` | An interaction related to press events. |

Known indirect subclasses [DragInteraction.Cancel](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Cancel), [DragInteraction.Start](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start), [DragInteraction.Stop](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Stop), [FocusInteraction.Focus](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus), [FocusInteraction.Unfocus](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Unfocus), [HoverInteraction.Enter](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter), [HoverInteraction.Exit](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Exit), [PressInteraction.Cancel](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Cancel), [PressInteraction.Press](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press), [PressInteraction.Release](https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Release)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Cancel` | An interaction representing the cancellation of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start` event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start` | An interaction representing a drag event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Stop` | An interaction representing the stopping of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/DragInteraction.Start` event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus` | An interaction representing a focus event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Unfocus` | An interaction representing a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/FocusInteraction.Focus` event being released on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter` | An interaction representing a hover event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Exit` | An interaction representing a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/HoverInteraction.Enter` event being released on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Cancel` | An interaction representing the cancellation of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press` event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press` | An interaction representing a press event on a component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Release` | An interaction representing the release of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.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 `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/PressInteraction.Press`. Using Interactions allows you to build components that respond to these transient, component-owned state changes.

To emit / observe current Interactions, see `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource`, which represents a stream of Interactions present for a given component.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/MutableInteractionSource` |   |