androidx.compose.material.ripple

Interfaces

RippleTheme

This interface is deprecated. RippleTheme and LocalRippleTheme have been deprecated - they are not compatible with the new ripple implementation using the new Indication APIs that provide notable performance improvements.

Cmn

Classes

RippleAlpha

RippleAlpha defines the alpha of the ripple / state layer for different Interactions.

Cmn

Composables

rememberRipple

Creates and remembers a Ripple using values provided by RippleTheme.

Cmn

Top-level functions summary

DelegatableNode
createRippleModifierNode(
    interactionSource: InteractionSource,
    bounded: Boolean,
    radius: Dp,
    color: ColorProducer,
    rippleAlpha: () -> RippleAlpha
)

Creates a Ripple node using the values provided.

Cmn

Top-level properties summary

ProvidableCompositionLocal<RippleTheme>

This property is deprecated. RippleTheme and LocalRippleTheme have been deprecated - they are not compatible with the new ripple implementation using the new Indication APIs that provide notable performance improvements.

Cmn

Top-level functions

createRippleModifierNode

fun createRippleModifierNode(
    interactionSource: InteractionSource,
    bounded: Boolean,
    radius: Dp,
    color: ColorProducer,
    rippleAlpha: () -> RippleAlpha
): DelegatableNode

Creates a Ripple node using the values provided.

A Ripple is a Material implementation of Indication that expresses different Interactions by drawing ripple animations and state layers.

A Ripple responds to PressInteraction.Press by starting a new RippleAnimation, and responds to other Interactions by showing a fixed StateLayer with varying alpha values depending on the Interaction.

This Ripple node is a low level building block for building IndicationNodeFactory implementations that use a Ripple - higher level design system libraries such as material and material3 provide Indication implementations using this node internally. In most cases you should use those factories directly: this node exists for design system libraries to delegate their Ripple implementation to, after querying any required theme values for customizing the Ripple.

NOTE: when using this factory with DelegatingNode.delegate, ensure that the node is created once or DelegatingNode.undelegate is called in Modifier.Node.onDetach. Repeatedly delegating to a new node returned by this method in Modifier.Node.onAttach without removing the old one will result in multiple ripple nodes being attached to the node.

Parameters
interactionSource: InteractionSource

the InteractionSource used to determine the state of the ripple.

bounded: Boolean

if true, ripples are clipped by the bounds of the target layout. Unbounded ripples always animate from the target layout center, bounded ripples animate from the touch position.

radius: Dp

the radius for the ripple. If Dp.Unspecified is provided then the size will be calculated based on the target layout size.

color: ColorProducer

the color of the ripple. This color is usually the same color used by the text or iconography in the component. This color will then have rippleAlpha applied to calculate the final color used to draw the ripple.

rippleAlpha: () -> RippleAlpha

the RippleAlpha that will be applied to the color depending on the state of the ripple.

Top-level properties

LocalRippleTheme

val LocalRippleThemeProvidableCompositionLocal<RippleTheme>

CompositionLocal used for providing RippleTheme down the tree.

See RippleTheme.defaultRippleColor and RippleTheme.defaultRippleAlpha functions for the default implementations for color and alpha.