# IndicationNodeFactory

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/Indication.kt+class:androidx.compose.foundation.IndicationNodeFactory) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface IndicationNodeFactory : Indication
  ```

*** ** * ** ***

IndicationNodeFactory is an Indication that creates `https://developer.android.com/reference/kotlin/androidx/compose/ui/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 `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/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 `https://developer.android.com/reference/kotlin/androidx/compose/foundation/package-summary#LocalIndication()` - you can provide a custom Indication to `https://developer.android.com/reference/kotlin/androidx/compose/foundation/package-summary#LocalIndication()` to change the default `https://developer.android.com/reference/kotlin/androidx/compose/foundation/Indication` used for components such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/clickable.modifier#(androidx.compose.ui.Modifier).clickable(kotlin.Boolean,kotlin.String,androidx.compose.ui.semantics.Role,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)`.

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DelegatableNode` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#create(androidx.compose.foundation.interaction.InteractionSource)(interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource)` Creates a node that will be applied to a specific component and render indication for the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#create(androidx.compose.foundation.interaction.InteractionSource)`. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` Require equals() to be implemented. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#hashCode()()` Require hashCode() to be implemented. | Cmn |

### Inherited functions

From [androidx.compose.foundation.Indication](https://developer.android.com/reference/kotlin/androidx/compose/foundation/Indication) `open https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationInstance` `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable
[rememberUpdatedInstance](https://developer.android.com/reference/kotlin/androidx/compose/foundation/Indication#rememberUpdatedInstance(androidx.compose.foundation.interaction.InteractionSource))(interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource)`

**This function is deprecated.** rememberUpdatedInstance has been deprecated - implementers should instead implement IndicationNodeFactory#create for improved performance and efficiency.
Cmn

## Public functions

### create

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
fun create(interactionSource: InteractionSource): DelegatableNode
```

Creates a node that will be applied to a specific component and render indication for the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#create(androidx.compose.foundation.interaction.InteractionSource)`. This method will be re-invoked for a given layout node if a new `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#create(androidx.compose.foundation.interaction.InteractionSource)` is provided or if `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#hashCode()` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#equals(kotlin.Any)` 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 `https://developer.android.com/reference/kotlin/androidx/compose/runtime/State` properties, so when the value of the State changes, `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#equals(kotlin.Any)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#hashCode()` remain the same, and the same node instance can just query the updated state value.

The returned `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DelegatableNode` should implement `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DrawModifierNode`, or delegate to a node that implements `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DrawModifierNode`, so that it can draw visual effects. Inside `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DrawModifierNode#(androidx.compose.ui.graphics.drawscope.ContentDrawScope).draw()`, make sure to call `https://developer.android.com/reference/kotlin/androidx/compose/ui/graphics/drawscope/ContentDrawScope#drawContent()` to render the component in addition to any visual effects.

| Parameters |
|---|---|
| `interactionSource: https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` | the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/InteractionSource` representing the stream of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/interaction/Interaction`s the returned node should render visual effects for |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DelegatableNode` | a `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DelegatableNode` that renders visual effects for the provided `https://developer.android.com/reference/kotlin/androidx/compose/foundation/IndicationNodeFactory#create(androidx.compose.foundation.interaction.InteractionSource)` by also implementing / delegating to a `https://developer.android.com/reference/kotlin/androidx/compose/ui/node/DrawModifierNode` |

### equals

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
operator fun equals(other: Any?): Boolean
```

Require equals() to be implemented. Using a data class is sufficient. Singletons may implement this function with referential equality (`this === other`). Instances with no properties may implement this function by checking the type of the other object.

### hashCode

Cmn Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.7.0)

```
fun hashCode(): Int
```

Require hashCode() to be implemented. Using a data class is sufficient. Singletons and instances with no properties may implement this function by returning an arbitrary constant.