AnimatedVisibility

abstract fun AnimatedVisibility(visible: Boolean, modifier: Modifier = Modifier, animation: AnimatedSpacingRowAnimation? = null, label: String = "AnimatedVisibility", content: @Composable () -> Unit)

Emits content while entering or leaving and animates its occupied width between zero and the measured content width. The parent row uses the same progress to animate spacing symmetrically on both sides.

The content is clipped to the animated width and can optionally fade on a graphics layer. If this modifier has RowScope.weight, the visible share of its allocation follows the animation progress and released space is redistributed among visible weighted siblings. Multiple direct children are measured as an overlay rather than arranged in a row; wrap them in a layout when more than one child is required.

Parameters

visible

whether the content should occupy its full measured width.

modifier

modifier applied to the visibility wrapper. Row scope modifiers such as weight, align, and alignBy are supported.

animation

optional cohesive override. null inherits the containing row's animation configuration.

label

label used for Compose animation tooling.

content

content shown while the transition's current or target state is visible.


abstract fun AnimatedVisibility(visibleState: MutableTransitionState<Boolean>, modifier: Modifier = Modifier, animation: AnimatedSpacingRowAnimation? = null, label: String = "AnimatedVisibility", content: @Composable () -> Unit)

State-driven counterpart to AnimatedVisibility whose transition remains active until the content's structural presence animation has completed.

Parameters

visibleState

observable current and target visibility state. Its isIdle becomes true only after size, spacing, and optional fade have reached the target.

modifier

modifier applied to the visibility wrapper. Row scope modifiers such as weight, align, and alignBy are supported.

animation

optional cohesive override. null inherits the containing row's animation configuration.

label

label used for Compose animation tooling.

content

content shown while the transition's current or target state is visible.