Skip to content

Component

Dialog

A FormaUI alert dialog — a modal that interrupts the user for a decision or acknowledgement, delegating to Material 3's AlertDialog.

dev.formaui.components.dialog

AlertFull-screen

Preview

This toggle is site chrome only — the preview has its own light/dark switch inside.

Live preview

Live preview — ~37 MB development build

Usage

var showDialog by remember { mutableStateOf(true) }
if (showDialog) {
    FormaAlertDialog(
        onDismissRequest = { showDialog = false },
        title = "Delete payment?",
        text = "This action can't be undone.",
        confirmButton = {
            FormaButton(onClick = {}) { Text("Delete") }
        },
        dismissButton = {
            FormaButton(onClick = { showDialog = false }, variant = FormaButtonVariant.Text) { Text("Cancel") }
        },
    )
}

FormaAlertDialog

Modal alert dialog for a decision or acknowledgement; shown while composed, with hoisted visibility state.

onDismissRequestrequiredType() -> UnitDefaultrequiredDescriptioncalled when the dialog is dismissed by tapping outside or pressing back.
confirmButtonrequiredType@Composable () -> UnitDefaultrequiredDescriptionthe primary action (required).
modifierTypeModifierDefaultModifierDescriptionthe Modifier applied to the dialog surface.
dismissButtonType(@Composable () -> Unit)?DefaultnullDescriptionthe optional secondary/cancel action.
iconType(@Composable () -> Unit)?DefaultnullDescriptionoptional icon shown above the title.
titleTypeString?DefaultnullDescriptionoptional dialog title.
textTypeString?DefaultnullDescriptionoptional supporting body text.
shapeTypeShapeDefaultFormaDialogDefaults.shapeDescriptionthe dialog container shape (defaults to FormaDialogDefaults.shape).
containerColorTypeColorDefaultAlertDialogDefaults.containerColorDescriptionthe dialog's background color (defaults to the M3 default, themed by FormaTheme).
iconContentColorTypeColorDefaultAlertDialogDefaults.iconContentColorDescriptionthe color applied to icon (defaults to the M3 default).
titleContentColorTypeColorDefaultAlertDialogDefaults.titleContentColorDescriptionthe color applied to title (defaults to the M3 default).
textContentColorTypeColorDefaultAlertDialogDefaults.textContentColorDescriptionthe color applied to text (defaults to the M3 default).
titleTextStyleTypeTextStyle?DefaultnullDescriptionoptional TextStyle override for title, merged on top of the M3 title style.
textTextStyleTypeTextStyle?DefaultnullDescriptionoptional TextStyle override for text, merged on top of the M3 text style.

FormaFullScreenDialog

Full-screen modal dialog for a focused multi-step task, with a top bar hosting Close, the title, and an optional confirm action.

onDismissRequestrequiredType() -> UnitDefaultrequiredDescriptioncalled when the user closes the dialog (Close button or back press).
titlerequiredTypeStringDefaultrequiredDescriptionthe dialog's title, shown in the top bar.
modifierTypeModifierDefaultModifierDescriptionthe Modifier applied to the dialog surface.
containerColorTypeColorDefaultMaterialTheme.colorScheme.surfaceDescriptionthe dialog surface's background color (defaults to the M3 surface, themed by FormaTheme).
contentColorTypeColorDefaultcontentColorFor(containerColor)Descriptionthe preferred content color inside the dialog (defaults to the color matching containerColor).
titleTextStyleTypeTextStyle?DefaultnullDescriptionoptional TextStyle override for title, merged on top of the top bar's title style (M3 titleLarge).
confirmActionType(@Composable () -> Unit)?DefaultnullDescriptionoptional top-bar action slot at the end (e.g. a "Save" FormaButton).
contentrequiredType@Composable ColumnScope.() -> UnitDefaultrequiredDescriptionthe dialog body, laid out in a scrollable ColumnScope.

Supporting API

FormaDialogDefaultsobject
Default values for FormaUI dialogs; shape returns FormaTheme.shapes.xl.

Accessibility

Both variants delegate dismissal to the underlying Dialog, so an outside tap or back press routes to onDismissRequest; FormaFullScreenDialog's Close control is a text FormaButton, so it announces its label without needing a contentDescription. Pass contentDescription = null on FormaAlertDialog's icon when the title already conveys the same meaning.