Jenga Dropdown Menu
fun JengaDropdownMenu(expanded: Boolean, onDismissRequest: () -> Unit, modifier: Modifier = Modifier, offset: DpOffset = DpOffset(0.dp, 0.dp), shape: Shape = JengaDropdownMenuDefaults.shape, border: BorderStroke? = JengaTheme.components.dropdownMenu?.border ?: JengaDropdownMenuDefaults.border, shadowElevation: Dp = JengaTheme.components.dropdownMenu?.shadowElevation ?: JengaDropdownMenuDefaults.ShadowElevation, width: Dp = JengaTheme.components.dropdownMenu?.width ?: JengaDropdownMenuDefaults.Width, content: @Composable ColumnScope.() -> Unit)(source)
A dropdown menu anchored to its caller, themed with Jenga tokens. Place JengaDropdownMenuItems in content. Control visibility via expanded.
Parameters
expanded
whether the menu is shown.
on Dismiss Request
called when the menu should close (outside tap / back).
modifier
the Modifier for the menu surface.
offset
offset from the anchor.
shape
the menu shape.
border
outline around the menu; defaults to the theme's border, else JengaDropdownMenuDefaults.border (a hairline in dark themes only). Pass null for none.
shadow Elevation
the menu shadow elevation; defaults to the theme's value, else JengaDropdownMenuDefaults.ShadowElevation.
width
the menu width; defaults to the theme's value, else JengaDropdownMenuDefaults.Width.
content
the menu items, in a ColumnScope.
Samples
var expanded by remember {
mutableStateOf(
value = false,
)
}
JengaDropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
content = {
JengaDropdownMenuItem(
text = "Re-enter",
onClick = { expanded = false },
)
JengaDropdownMenuItem(
text = "View history",
onClick = { expanded = false },
)
},
)Content copied to clipboard