Jenga Dialog
fun JengaDialog(onDismissRequest: () -> Unit, confirmButton: @Composable () -> Unit, modifier: Modifier = Modifier, title: String? = null, text: String? = null, dismissButton: @Composable () -> Unit? = null, shape: Shape = JengaDialogDefaults.shape, contentPadding: PaddingValues = JengaDialogDefaults.contentPadding, titleStyle: TextStyle = JengaDialogDefaults.titleStyle, textStyle: TextStyle = JengaDialogDefaults.textStyle, actionSpacing: Dp = JengaDialogDefaults.actionSpacing, colors: JengaDialogColors = JengaDialogDefaults.colors(), border: BorderStroke? = JengaDialogDefaults.border)(source)
A modal dialog with an optional title and body, plus confirm/dismiss actions. For a destructive confirmation, pass a danger JengaButton as confirmButton.
Parameters
on Dismiss Request
called when the user dismisses (scrim tap or back).
confirm Button
the primary action (e.g. a JengaButton).
modifier
the Modifier for the dialog surface.
title
optional title.
text
optional body text.
dismiss Button
optional secondary action.
shape
the dialog shape.
content Padding
padding inside the dialog.
title Style
the title text style.
text Style
the text text style.
action Spacing
gap between the actions.
colors
the color set; defaults to JengaDialogDefaults.colors.
border
outline around the dialog; defaults to JengaDialogDefaults.border (a hairline in dark themes only). Pass null for none.
Samples
var open by remember {
mutableStateOf(
value = true,
)
}
if (open) {
JengaDialog(
onDismissRequest = { open = false },
title = "Reset device?",
text = "This clears the cached gate session.",
confirmButton = {
JengaButton(
text = "Reset",
onClick = { open = false },
variant = JengaButtonVariant.Danger,
)
},
dismissButton = {
JengaButton(
text = "Cancel",
onClick = { open = false },
variant = JengaButtonVariant.Ghost,
)
},
)
}Content copied to clipboard