SuccessConfirmationDialogContent

SuccessConfirmationDialogContent provides the content for a success confirmation dialog with a success icon and optional short curved text. This variation of confirmation dialog indicates a successful operation or action.

Android
@Composable
public fun SuccessConfirmationDialogContent(
    curvedText: (CurvedScope.() -> Unit)?,
    modifier: Modifier = Modifier,
    colors: ConfirmationDialogColors = ConfirmationDialogDefaults.successColors(),
    content: @Composable () -> Unit = { ConfirmationDialogDefaults.SuccessIcon() },
)

Parameters

curvedText A slot for displaying curved text content which will be shown along the bottom edge of the dialog. We recommend using confirmationDialogCurvedText for this parameter, which will give the default sweep angle and padding, and ConfirmationDialogDefaults.curvedTextStyle as the style.
modifier Modifier to be applied to the confirmation content.
colors A ConfirmationDialogColors object for customizing the colors used in this SuccessConfirmationDialog. will be adjusted by the accessibility manager according to the content displayed.
content A slot for displaying an icon inside the confirmation dialog, which can be animated. Defaults to an animated ConfirmationDialogDefaults.SuccessIcon.

Code Examples

SuccessConfirmationDialogSample

@Composable
fun SuccessConfirmationDialogSample() {
    var showConfirmation by remember { mutableStateOf(false) }
    Box(Modifier.fillMaxSize()) {
        FilledTonalButton(
            modifier = Modifier.align(Alignment.Center),
            onClick = { showConfirmation = true },
            label = { Text("Show Confirmation") },
        )
    }
    val text = "Success"
    val style = ConfirmationDialogDefaults.curvedTextStyle
    SuccessConfirmationDialog(
        visible = showConfirmation,
        onDismissRequest = { showConfirmation = false },
        curvedText = { confirmationDialogCurvedText(text, style) },
    )
}