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

ParameterTypeDefaultDescription
onDismissRequest() -> UnitCalled when the user taps outside the dialog or presses back.
openBooleanControls whether the dialog is shown.
modifierModifierModifierApplied to the dialog's content card.
title@Composable () -> UnitHeader slot; conventionally wraps content in AlertDialogTitle.
description@Composable () -> UnitBody slot; conventionally wraps content in AlertDialogDescription.
actions@Composable () -> UnitFooter 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.

ParameterTypeDefaultDescription
modifierModifierModifierApplied to the wrapper column.
content@Composable () -> UnitTitle content.

AlertDialogDescription

Thin Column wrapper for the dialog body text. Use inside the description slot.

ParameterTypeDefaultDescription
modifierModifierModifierApplied to the wrapper column.
content@Composable () -> UnitDescription content.

AlertDialogAction

Primary action button backed by Button with ButtonVariant.Default. Place inside the actions slot.

ParameterTypeDefaultDescription
onClick() -> UnitCalled when the button is tapped.
modifierModifierModifierApplied to the button.
content@Composable () -> UnitButton label content.

AlertDialogCancel

Secondary cancel button backed by Button with ButtonVariant.Outline. Place inside the actions slot.

ParameterTypeDefaultDescription
onClick() -> UnitCalled when the button is tapped.
modifierModifierModifierApplied to the button.
content@Composable () -> UnitButton label content.
Edit this page on GitHub