← Back to Wear Material
ConfirmationDialog
Component
in
Wear Material
. Since 1.0.0-alpha12Overview
Examples
Community Notes
Video
ConfirmationDialog is an opinionated dialog that displays a message to the user for durationMillis. It has a slot for an icon or image (which could be animated).
ConfirmationDialog can also be acknowledged via swipe-to-dismiss if the dialog is displayed as a destination in a navigation graph e.g. using SwipeDismissableNavHost.
Example of a ConfirmationDialog with animation:
Overloads
ConfirmationDialog
@Composable
public fun ConfirmationDialog(
onTimeout: () -> Unit,
modifier: Modifier = Modifier,
icon: @Composable (() -> Unit)? = null,
scrollState: ScrollState = rememberScrollState(),
durationMillis: Long = DialogDefaults.ShortDurationMillis,
backgroundColor: Color = MaterialTheme.colors.background,
contentColor: Color = contentColorFor(backgroundColor),
iconTintColor: Color = contentColor,
contentPadding: PaddingValues = DialogDefaults.ConfirmationContentPadding,
content: @Composable () -> Unit
)
Parameters
Name | Description |
---|---|
onTimeout | Event invoked when the dialog has been shown for durationMillis. Must remove the ConfirmationDialog from the composition. |
modifier | Modifier to be applied to the dialog. |
icon | An optional slot for displaying an icon or image. |
scrollState | The scroll state for the dialog so that the scroll position can be displayed e.g. by the PositionIndicator passed to Scaffold. |
durationMillis | The number of milliseconds for which the dialog is displayed, must be positive. Suggested values are DialogDefaults.ShortDurationMillis, DialogDefaults.LongDurationMillis or DialogDefaults.IndefiniteDurationMillis. |
backgroundColor | Color representing the background color for this dialog. |
contentColor | Color representing the color for content. |
iconTintColor | Icon Color that defaults to the contentColor, unless specifically overridden. |
contentPadding | The padding to apply around the whole of the dialog's contents. |
content | A slot for the dialog title, expected to be one line of text |
Previous Component← Confirmation
Next ComponentCurvedText →