rememberPlaceholderState

Composable Function

Android
@Composable
public fun rememberPlaceholderState(isVisible: Boolean): PlaceholderState

Creates a PlaceholderState that is remembered across compositions.

A PlaceholderState should be created for each component that has placeholder data, such as a Card or a Button. The state is used to coordinate all of the different placeholder effects and animations.

Placeholder has a number of different effects designed to work together. Modifier.placeholderShimmer does a shimmer animation over the whole component that includes the placeholders. There should only be one placeholderShimmer for each component. Modifier.placeholder draws a placeholder shape on top of content that is waiting to load. There can be multiple placeholders in a component. For example, one for the title of an AppCard, another for the app name, and so on.

Once all of the components content is loaded, isVisible is false the shimmer will stop and a wipe off animation will remove the placeholders to reveal the content.

Parameters

isVisiblethe initial state of the placeholder.