This expands the clip bounds of the appearing content vertically, from the height returned from [initialHeight] to the full height.
ExpandShrinkVerticallySample
@Composable
fun ExpandShrinkVerticallySample() {
var visible by remember { mutableStateOf(true) }
AnimatedVisibility(
visible,
// Sets the initial height of the content to 20, revealing only the top of the content at
// the beginning of the expanding animation.
enter = expandVertically(expandFrom = Alignment.Top) { 20 },
// Shrinks the content to half of its full height via an animation.
exit = shrinkVertically(animationSpec = tween()) { fullHeight -> fullHeight / 2 },
) {
// Content that needs to appear/disappear goes here:
Text("Content to appear/disappear", Modifier.fillMaxWidth().requiredHeight(200.dp))
}
}