AnimatedVisibility

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

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

The content is clipped to the animated height and can optionally fade on a graphics layer. If this modifier has ColumnScope.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 stacked; wrap them in a layout when more than one child is required.

Parameters

visible

whether the content should occupy its full measured height.

modifier

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

animation

optional cohesive override. null inherits the containing column'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: AnimatedSpacingColumnAnimation? = 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. Column scope modifiers such as weight, align, and alignBy are supported.

animation

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

label

label used for Compose animation tooling.

content

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