cascade¶
cascade
offers a drop-in replacement for DropdownMenu
with support for nested menus, smooth height animations and 0dp
vertical content paddings.
implementation "me.saket.cascade:cascade-compose:2.3.0"
implementation "androidx.compose.material3:material3:…" // https://d.android.com/jetpack/androidx/releases/compose-material3
var isMenuVisible by rememberSaveable { mutableStateOf(false) }
CascadeDropdownMenu(
expanded = isMenuVisible,
onDismissRequest = { isMenuVisible = false }
) {
DropdownMenuItem(
text = { Text("Horizon") },
children = {
DropdownMenuItem(
text = { Text("Zero Dawn") },
onClick = { … }
)
DropdownMenuItem(
text = { Text("Forbidden West") },
onClick = { … }
)
}
)
}