Skip to content

InteractionSource

interface InteractionSource

A read-only stream of Interactions a component emits about itself (press, hover, focus, drag). Several independent pieces of UI - the widget's own visuals, a shared "indication" effect, a test assertion - can all observe the same interaction state this way, instead of each hand-rolling its own separate hovered/pressed/focused booleans.

Inheritors

Properties

interactions

abstract val interactions: Flow<Interaction>

Functions

collectIsDraggedAsState

true while a drag is active (until its DragInteraction.Stop/DragInteraction.Cancel).

collectIsFocusedAsState

true while the component holds vanilla keyboard/controller focus.

collectIsHoveredAsState

true while the pointer is hovering the component.

collectIsPressedAsState