Alert Dialog
A modal dialog that interrupts the user with important content and expects a response, with slots for title, description, and action buttons.
AlertDialog wraps the Compose Dialog primitive and renders a card-shaped surface with a title, description, and a right-aligned actions row. Visibility is fully controlled by the caller via the open parameter. Use AlertDialogAction for the primary button and AlertDialogCancel for the secondary button — both are pre-styled Button wrappers.
Basic usage
API reference
AlertDialog
| Parameter | Type | Default | Description |
|---|---|---|---|
onDismissRequest | () -> Unit | — | Called when the user taps outside the dialog or presses back. |
open | Boolean | — | Controls whether the dialog is shown. |
modifier | Modifier | Modifier | Applied to the dialog's content card. |
title | @Composable () -> Unit | — | Header slot; conventionally wraps content in AlertDialogTitle. |
description | @Composable () -> Unit | — | Body slot; conventionally wraps content in AlertDialogDescription. |
actions | @Composable () -> Unit | — | Footer slot rendered in a right-aligned Row. Place AlertDialogCancel and AlertDialogAction here. |
AlertDialogTitle
Thin Column wrapper that provides consistent spacing for the dialog title. Use inside the title slot.
| Parameter | Type | Default | Description |
|---|---|---|---|
modifier | Modifier | Modifier | Applied to the wrapper column. |
content | @Composable () -> Unit | — | Title content. |
AlertDialogDescription
Thin Column wrapper for the dialog body text. Use inside the description slot.
| Parameter | Type | Default | Description |
|---|---|---|---|
modifier | Modifier | Modifier | Applied to the wrapper column. |
content | @Composable () -> Unit | — | Description content. |
AlertDialogAction
Primary action button backed by Button with ButtonVariant.Default. Place inside the actions slot.
| Parameter | Type | Default | Description |
|---|---|---|---|
onClick | () -> Unit | — | Called when the button is tapped. |
modifier | Modifier | Modifier | Applied to the button. |
content | @Composable () -> Unit | — | Button label content. |
AlertDialogCancel
Secondary cancel button backed by Button with ButtonVariant.Outline. Place inside the actions slot.
| Parameter | Type | Default | Description |
|---|---|---|---|
onClick | () -> Unit | — | Called when the button is tapped. |
modifier | Modifier | Modifier | Applied to the button. |
content | @Composable () -> Unit | — | Button label content. |