Dialog

fun Dialog(onDismissRequest: () -> Unit, title: @Composable () -> Unit, text: @Composable () -> Unit, confirmButton: @Composable () -> Unit, modifier: Modifier = Modifier, dismissButton: @Composable () -> Unit = {}, illustration: @Composable () -> Unit = {}, properties: DialogProperties = DialogProperties())

Draws an Orbit-themed modal dialog with either one or two actions.

According to Orbit, one should use ButtonPrimary() for the primary action or ButtonCritical() provided that the primary action is destructive in its nature. Put the primary action button in the confirmButton slot.

Secondary action should use ButtonLinkPrimary() or ButtonLinkCritical() respectively. In certain cases, one may also use ButtonLinkSecondary(). Put the secondary action button in the dismissButton slot.

Example:

Dialog(
onDismissRequest = {},
title = { Text("Title") },
text = { Text("Text") },
confirmButton = {
ButtonPrimary(
modifier = Modifier.fillMaxWidth(),
) {
Text("Confirm")
}
},
dismissButton = {
ButtonLinkSecondary(
onClick = {},
modifier = Modifier.fillMaxWidth(),
) {
Text("Dismiss")
}
},
illustration = {
Image(
painter = Illustrations.NoNotification,
contentDescription = null,
modifier = Modifier.fillMaxWidth(0.64f),
)
},
)

fun Dialog(onDismissRequest: () -> Unit, title: @Composable () -> Unit, text: @Composable () -> Unit, buttons: @Composable ColumnScope.() -> Unit, modifier: Modifier = Modifier, illustration: @Composable () -> Unit = {}, properties: DialogProperties = DialogProperties())

Draws an Orbit-themed modal dialog with multiple actions.

According to Orbit, one should use ButtonPrimary() for the primary action or ButtonCritical() provided that the primary action is destructive in its nature.

One should use ButtonLinkPrimary() or ButtonLinkCritical() for secondary actions. In certain cases, one may also use ButtonLinkSecondary().

Actions are displayed in a consecutive manner.

Example:

Dialog(
onDismissRequest = {},
title = { Text("Title") },
text = { Text("Text") },
buttons = {
ButtonPrimary(
modifier = Modifier.fillMaxWidth(),
) {
Text("Confirm")
}

ButtonLinkPrimary(
onClick = {},
modifier = Modifier.fillMaxWidth(),
) {
Text("Maybe later")
}

ButtonLinkSecondary(
onClick = {},
modifier = Modifier.fillMaxWidth(),
) {
Text("""Don't show again""")
}
},
illustration = {
Image(
painter = Illustrations.NoNotification,
contentDescription = null,
modifier = Modifier.fillMaxWidth(0.64f),
)
},
)