androidx.compose.foundation.interaction

Interfaces

DragInteraction

An interaction related to drag events.

Cmn
FocusInteraction

An interaction related to focus events.

Cmn
HoverInteraction

An interaction related to hover events.

Cmn
Interaction

An Interaction represents transient UI state for a component, typically separate from the actual 'business' state that a component may control.

Cmn
InteractionSource

InteractionSource represents a stream of Interactions corresponding to events emitted by a component.

Cmn
MutableInteractionSource

MutableInteractionSource represents a stream of Interactions corresponding to events emitted by a component.

Cmn
PressInteraction

An interaction related to press events.

Cmn

Classes

DragInteraction.Cancel

An interaction representing the cancellation of a Start event on a component.

Cmn
DragInteraction.Start

An interaction representing a drag event on a component.

Cmn
DragInteraction.Stop

An interaction representing the stopping of a Start event on a component.

Cmn
FocusInteraction.Focus

An interaction representing a focus event on a component.

Cmn
FocusInteraction.Unfocus

An interaction representing a Focus event being released on a component.

Cmn
HoverInteraction.Enter

An interaction representing a hover event on a component.

Cmn
HoverInteraction.Exit

An interaction representing a Enter event being released on a component.

Cmn
PressInteraction.Cancel

An interaction representing the cancellation of a Press event on a component.

Cmn
PressInteraction.Press

An interaction representing a press event on a component.

Cmn
PressInteraction.Release

An interaction representing the release of a Press event on a component.

Cmn

Top-level functions summary

MutableInteractionSource

Return a new MutableInteractionSource that can be hoisted and provided to components, allowing listening to Interaction changes inside those components.

Cmn

Extension functions summary

State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is dragged or not.

Cmn
State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is focused or not.

Cmn
State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is hovered or not.

Cmn
State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is pressed or not.

Cmn

Top-level functions

MutableInteractionSource

fun MutableInteractionSource(): MutableInteractionSource

Return a new MutableInteractionSource that can be hoisted and provided to components, allowing listening to Interaction changes inside those components.

This should be remembered before it is provided to components, so it can maintain its state across compositions.

Extension functions

collectIsDraggedAsState

@Composable
fun InteractionSource.collectIsDraggedAsState(): State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is dragged or not.

DragInteraction is typically set by interactions such as androidx.compose.foundation.gestures.draggable and androidx.compose.foundation.gestures.scrollable, and higher level components such as androidx.compose.foundation.lazy.LazyRow, available through androidx.compose.foundation.lazy.LazyListState.interactionSource.

Returns
State<Boolean>

State representing whether this component is being dragged or not

collectIsFocusedAsState

@Composable
fun InteractionSource.collectIsFocusedAsState(): State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is focused or not.

FocusInteraction is typically set by androidx.compose.foundation.focusable and focusable components, such as androidx.compose.foundation.text.BasicTextField.

Returns
State<Boolean>

State representing whether this component is being focused or not

collectIsHoveredAsState

@Composable
fun InteractionSource.collectIsHoveredAsState(): State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is hovered or not.

HoverInteraction is typically set by androidx.compose.foundation.hoverable and hoverable components.

Returns
State<Boolean>

State representing whether this component is being hovered or not

collectIsPressedAsState

@Composable
fun InteractionSource.collectIsPressedAsState(): State<Boolean>

Subscribes to this MutableInteractionSource and returns a State representing whether this component is pressed or not.

PressInteraction is typically set by androidx.compose.foundation.clickable and clickable higher level components, such as buttons.

Returns
State<Boolean>

State representing whether this component is being pressed or not