Jenga Bottom Sheet
A modal bottom sheet, themed with Jenga tokens.
Control visibility by conditional composition: render this only while the sheet should be shown:
if (showSheet) {
JengaBottomSheet(
onDismissRequest = { showSheet = false },
content = { /* content */},
)
}For imperative control (e.g. animating the sheet closed in response to a ViewModel effect before navigating), use the overload that takes a JengaSheetState from rememberJengaSheetState.
Parameters
called after the sheet has closed (drag down, scrim or Back).
the Modifier for the sheet.
the sheet body, laid out in a ColumnScope.
Samples
var open by remember {
mutableStateOf(
value = true,
)
}
if (open) {
JengaBottomSheet(
onDismissRequest = { open = false },
content = {
JengaText(
text = "Select a gate",
)
},
)
}A modal bottom sheet whose visibility is driven by an external sheetState, so it can be shown/hidden imperatively (the MVI pattern: a ViewModel effect calls sheetState.hide(), then composition removes the sheet).
Parameters
called after the sheet has closed (drag down, scrim or Back). Not called when the state's confirmDismiss keeps it open.
the externally-owned state from rememberJengaSheetState.
the Modifier for the sheet.
whether the sheet can be dragged. When false, the drag handle stays visible, the sheet stays put, and gestures inside the content (a drawing pad, a list) still work.
the sheet body, laid out in a ColumnScope.