androidx.compose.foundation

IndicationNodeFactory

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

No hand-written docs yet.

IndicationNodeFactory is an Indication that creates Modifier.Node instances to render visual effects that occur when certain interactions happens. For example: showing a ripple effect when a component is pressed, or a highlight when a component is focused.

interface IndicationNodeFactory : Indication

Is a

How to get one

Ready-made values and functions that return it

Functions

create

fun create(interactionSource: InteractionSource): DelegatableNode

Creates a node that will be applied to a specific component and render indication for the provided interactionSource. This method will be re-invoked for a given layout node if a new interactionSource is provided or if hashCode or equals change for this IndicationNodeFactory over time, allowing a new node to be created using the new properties in this IndicationNodeFactory. If you instead want to gracefully update the existing node over time, consider replacing those properties with androidx.compose.runtime.State properties, so when the value of the State changes, equals and hashCode remain the same, and the same node instance can just query the updated state value.

Library docs

IndicationNodeFactory is an Indication that creates Modifier.Node instances to render visual effects that occur when certain interactions happens. For example: showing a ripple effect when a component is pressed, or a highlight when a component is focused.

An instance of IndicationNodeFactory is responsible for creating individual nodes on demand for each component that needs to render indication. IndicationNodeFactory instances should be very simple - they just hold the relevant configuration properties needed to create the node instances that are responsible for drawing visual effects.

IndicationNodeFactory is conceptually similar to ModifierNodeElement - it is designed to be able to be created outside of composition, and re-used in multiple places.

Indication is typically provided throughout the hierarchy through LocalIndication - you can provide a custom Indication to LocalIndication to change the default Indication used for components such as clickable.