State of Compose 2023 results are in! Click here to learn more

← Back to Compose UI

Dialog

Component
in
Compose UI
. Since 0.1.0-dev16

Overview

Code Examples

Video

Opens a dialog with the given content.

A dialog is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the screen and is normally used for modal events that require users to take an action before they can proceed.

The dialog is visible as long as it is part of the composition hierarchy. In order to let the user dismiss the Dialog, the implementation of onDismissRequest should contain a way to remove the dialog from the composition hierarchy.

Overloads

Dialog

@Composable
fun Dialog(
    onDismissRequest: () -> Unit,
    properties: DialogProperties = DialogProperties(),
    content: @Composable () -> Unit
)

Parameters

NameDescription
onDismissRequestExecutes when the user tries to dismiss the dialog.
propertiesDialogProperties for further customization of this dialog's behavior.
contentThe content to be displayed inside the dialog