# ConfirmationDialog

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)( visible: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, onDismissRequest: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, curvedText: (https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/CurvedScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors, properties: https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Shows a transient `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and optional very short `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)( visible: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, onDismissRequest: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html, text: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/ColumnScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors, properties: https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties, durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Shows a transient `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and optional short `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. |

## Functions

### ConfirmationDialog

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/ConfirmationDialog.kt+function:ConfirmationDialog) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
@Composable
fun ConfirmationDialog(
    visible: Boolean,
    onDismissRequest: () -> Unit,
    curvedText: (CurvedScope.() -> Unit)?,
    modifier: Modifier = Modifier,
    colors: ConfirmationDialogColors = ConfirmationDialogDefaults.colors(),
    properties: DialogProperties = DialogProperties(),
    durationMillis: Long = ConfirmationDialogDefaults.DurationMillis,
    content: @Composable () -> Unit
): Unit
```

Shows a transient `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and optional very short `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. The length of the curved text should be very short and should not exceed 1-2 words. If a longer text is required, then the alternative `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` overload with slot for linear text should be used instead.

The `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` shows a message to the user for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. After a specified timeout, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` callback will be invoked, where it's up to the caller to handle the dismissal. To hide the confirmation dialog, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` parameter should be set to false.

Where user input is required, such as choosing to ok or cancel an action, use `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AlertDialog.composable#AlertDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function0,kotlin.Function0,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.window.DialogProperties,kotlin.Function1)` instead of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`.

Example of a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and a curved text content:

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.wear.compose.material3.ConfirmationDialog
import androidx.wear.compose.material3.ConfirmationDialogDefaults
import androidx.wear.compose.material3.FilledTonalButton
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.Text
import androidx.wear.compose.material3.confirmationDialogCurvedText
import androidx.wear.compose.material3.samples.icons.FavoriteIcon

var showConfirmation by remember { mutableStateOf(false) }

Box(Modifier.fillMaxSize()) {
    FilledTonalButton(
        modifier = Modifier.align(Alignment.Center),
        onClick = { showConfirmation = true },
        label = { Text("Show Confirmation") },
    )
}

// Has an icon and a short curved text content, which will be displayed along the bottom edge of
// the screen.
val curvedTextStyle = ConfirmationDialogDefaults.curvedTextStyle
ConfirmationDialog(
    visible = showConfirmation,
    onDismissRequest = { showConfirmation = false },
    curvedText = { confirmationDialogCurvedText("Confirmed", curvedTextStyle) },
) {
    FavoriteIcon(ConfirmationDialogDefaults.IconSize)
}
```

| Parameters |
|---|---|
| `visible: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | A boolean indicating whether the confirmation dialog should be displayed. |
| `onDismissRequest: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A lambda function to be called when the dialog is dismissed - either by swiping right or when the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` has passed. Implementation of this lambda must remove the dialog from the composition hierarchy e.g. by setting `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` to false. |
| `curvedText: (https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/CurvedScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?` | A slot for displaying curved text content which will be shown along the bottom edge of the dialog. We recommend using `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#(androidx.wear.compose.foundation.CurvedScope).confirmationDialogCurvedText(kotlin.String,androidx.wear.compose.foundation.CurvedTextStyle)` for this parameter, which will give the default sweep angle and padding. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | Modifier to be applied to the confirmation content. |
| `colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors = ConfirmationDialogDefaults.colors()` | A `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors` object for customizing the colors used in this `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. |
| `properties: https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties = DialogProperties()` | An optional `https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties` object for configuring the dialog's behavior. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = ConfirmationDialogDefaults.DurationMillis` | The duration in milliseconds for which the dialog is displayed. This value will be adjusted by the accessibility manager according to the content displayed. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A slot for displaying an icon inside the confirmation dialog. It's recommended to set its size to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogDefaults#IconSize()` |

### ConfirmationDialog

Artifact: [androidx.wear.compose:compose-material3](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material3/ConfirmationDialog.kt+function:ConfirmationDialog) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.5.0)

```
@Composable
fun ConfirmationDialog(
    visible: Boolean,
    onDismissRequest: () -> Unit,
    text: (@Composable ColumnScope.() -> Unit)?,
    modifier: Modifier = Modifier,
    colors: ConfirmationDialogColors = ConfirmationDialogDefaults.colors(),
    properties: DialogProperties = DialogProperties(),
    durationMillis: Long = ConfirmationDialogDefaults.DurationMillis,
    content: @Composable () -> Unit
): Unit
```

Shows a transient `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and optional short `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. The length of the text should not exceed 3 lines. If the text is very short and fits into 1-2 words, consider using the alternative `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` overload with the curvedText parameter instead.

The confirmation dialog will show a message to the user for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. After a specified timeout, the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` callback will be invoked, where it's up to the caller to handle the dismissal. To hide the confirmation dialog, `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` parameter should be set to false.

Where user input is required, such as choosing to ok or cancel an action, use `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/AlertDialog.composable#AlertDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,kotlin.Function0,androidx.compose.ui.Modifier,kotlin.Function1,kotlin.Function0,kotlin.Function0,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.foundation.layout.PaddingValues,androidx.compose.ui.window.DialogProperties,kotlin.Function1)` instead of `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`.

Example of a `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` with an icon and a text which fits into 3 lines:

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.Send
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.wear.compose.material3.ConfirmationDialog
import androidx.wear.compose.material3.ConfirmationDialogDefaults
import androidx.wear.compose.material3.FilledTonalButton
import androidx.wear.compose.material3.Icon
import androidx.wear.compose.material3.Text

var showConfirmation by remember { mutableStateOf(false) }

Box(Modifier.fillMaxSize()) {
    FilledTonalButton(
        modifier = Modifier.align(Alignment.Center),
        onClick = { showConfirmation = true },
        label = { Text("Show Confirmation") },
    )
}

// Has an icon and a text content. Text will be displayed in the center of the screen below the
// icon.
ConfirmationDialog(
    visible = showConfirmation,
    onDismissRequest = { showConfirmation = false },
    text = { Text(text = "Your message has been sent") },
) {
    Icon(
        imageVector = Icons.AutoMirrored.Filled.Send,
        contentDescription = null,
        modifier = Modifier.size(ConfirmationDialogDefaults.SmallIconSize),
    )
}
```

| Parameters |
|---|---|
| `visible: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | A boolean indicating whether the confirmation dialog should be displayed. |
| `onDismissRequest: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A lambda function to be called when the dialog is dismissed - either by swiping right or when the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` has passed. Implementation of this lambda must remove the dialog from the composition hierarchy e.g. by setting `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/package-summary#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)` to false. |
| `text: (@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/ColumnScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?` | A slot for displaying text below the icon. It should not exceed 3 lines. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | Modifier to be applied to the confirmation content. |
| `colors: https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors = ConfirmationDialogDefaults.colors()` | A `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogColors` object for customizing the colors used in this `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialog.composable#ConfirmationDialog(kotlin.Boolean,kotlin.Function0,kotlin.Function1,androidx.compose.ui.Modifier,androidx.wear.compose.material3.ConfirmationDialogColors,androidx.compose.ui.window.DialogProperties,kotlin.Long,kotlin.Function0)`. |
| `properties: https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties = DialogProperties()` | An optional `https://developer.android.com/reference/kotlin/androidx/compose/ui/window/DialogProperties` object for configuring the dialog's behavior. |
| `durationMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = ConfirmationDialogDefaults.DurationMillis` | The duration in milliseconds for which the dialog is displayed. This value will be adjusted by the accessibility manager according to the content displayed. |
| `content: @https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | A slot for displaying an icon inside the confirmation dialog, which can be animated. It's recommended to set its size to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/ConfirmationDialogDefaults#SmallIconSize()` |