<h2 id="swipetodismissbox-state-modifier-backgroundscrimcolor-contentscrimcolor-backgroundkey-contentkey-hasbackground-content">SwipeToDismissBox</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
@Composable
public fun SwipeToDismissBox(
    state: androidx.wear.compose.foundation.SwipeToDismissBoxState,
    modifier: Modifier = Modifier,
    backgroundScrimColor: Color = MaterialTheme.colors.background,
    contentScrimColor: Color = MaterialTheme.colors.background,
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    hasBackground: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

#### Parameters

| | |
| --- | --- |
| state | State containing information about ongoing swipe or animation. |
| modifier | Optional [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| backgroundScrimColor | Color for background scrim |
| contentScrimColor | Optional [Color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) used for the scrim over the content composable during the swipe gesture. |
| backgroundKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == true. Provide the backgroundKey if your background content will be displayed as a foreground after the swipe animation ends (as is common when [SwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-material/components/SwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == false. See `backgroundKey`. |
| hasBackground | Optional [Boolean] used to indicate if the content has no background, in which case the swipe gesture is disabled (since there is no parent destination). |
| content | Slot for content, with the isBackground parameter enabling content to be displayed behind the foreground content - the background is normally hidden, is shown behind a scrim during the swipe gesture, and is shown without scrim once the finger passes the swipe-to-dismiss threshold. |

<div class='sourceset sourceset-android'>Android</div>

> **Deprecated** This overload is provided for backwards compatibility. A newer overload is available that uses androidx.wear.compose.foundation.SwipeToDismissBoxState.

<hr class="docs-overload-divider">

<h2 id="swipetodismissbox-state-modifier-backgroundscrimcolor-contentscrimcolor-backgroundkey-contentkey-hasbackground-content-2">SwipeToDismissBox</h2>

```kotlin
@Composable
public fun SwipeToDismissBox(
    state: SwipeToDismissBoxState,
    modifier: Modifier = Modifier,
    backgroundScrimColor: Color = MaterialTheme.colors.background,
    contentScrimColor: Color = MaterialTheme.colors.background,
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    hasBackground: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

#### Parameters

| | |
| --- | --- |
| state | State containing information about ongoing swipe or animation. |
| modifier | Optional [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| backgroundScrimColor | Color for background scrim |
| contentScrimColor | Optional [Color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) used for the scrim over the content composable during the swipe gesture. |
| backgroundKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == true. Provide the backgroundKey if your background content will be displayed as a foreground after the swipe animation ends (as is common when [SwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-material/components/SwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == false. See `backgroundKey`. |
| hasBackground | Optional [Boolean] used to indicate if the content has no background, in which case the swipe gesture is disabled (since there is no parent destination). |
| content | Slot for content, with the isBackground parameter enabling content to be displayed behind the foreground content - the background is normally hidden, is shown behind a scrim during the swipe gesture, and is shown without scrim once the finger passes the swipe-to-dismiss threshold. |

<hr class="docs-overload-divider">

<h2 id="swipetodismissbox-ondismissed-modifier-state-backgroundscrimcolor-contentscrimcolor-backgroundkey-contentkey-hasbackground-content">SwipeToDismissBox</h2>

<div class='sourceset sourceset-android'>Android</div>

```kotlin
@Composable
public fun SwipeToDismissBox(
    onDismissed: () -> Unit,
    modifier: Modifier = Modifier,
    state: androidx.wear.compose.foundation.SwipeToDismissBoxState =
        androidx.wear.compose.foundation.rememberSwipeToDismissBoxState(),
    backgroundScrimColor: Color = MaterialTheme.colors.background,
    contentScrimColor: Color = MaterialTheme.colors.background,
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    hasBackground: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

#### Parameters

| | |
| --- | --- |
| onDismissed | Executes when the swipe to dismiss has completed. |
| modifier | Optional [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| state | State containing information about ongoing swipe or animation. |
| backgroundScrimColor | Color for background scrim |
| contentScrimColor | Optional [Color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) used for the scrim over the content composable during the swipe gesture. |
| backgroundKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == true. Provide the backgroundKey if your background content will be displayed as a foreground after the swipe animation ends (as is common when [SwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-material/components/SwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == false. See `backgroundKey`. |
| hasBackground | Optional [Boolean] used to indicate if the content has no background, in which case the swipe gesture is disabled (since there is no parent destination). |
| content | Slot for content, with the isBackground parameter enabling content to be displayed behind the foreground content - the background is normally hidden, is shown behind a scrim during the swipe gesture, and is shown without scrim once the finger passes the swipe-to-dismiss threshold. |

<div class='sourceset sourceset-android'>Android</div>

> **Deprecated** This overload is provided for backwards compatibility. A newer overload is available that uses androidx.wear.compose.foundation.SwipeToDismissBoxState.

<hr class="docs-overload-divider">

<h2 id="swipetodismissbox-ondismissed-modifier-state-backgroundscrimcolor-contentscrimcolor-backgroundkey-contentkey-hasbackground-content-2">SwipeToDismissBox</h2>

```kotlin
@Composable
public fun SwipeToDismissBox(
    onDismissed: () -> Unit,
    modifier: Modifier = Modifier,
    state: SwipeToDismissBoxState = rememberSwipeToDismissBoxState(),
    backgroundScrimColor: Color = MaterialTheme.colors.background,
    contentScrimColor: Color = MaterialTheme.colors.background,
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    hasBackground: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

#### Parameters

| | |
| --- | --- |
| onDismissed | Executes when the swipe to dismiss has completed. |
| modifier | Optional [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| state | State containing information about ongoing swipe or animation. |
| backgroundScrimColor | Color for background scrim |
| contentScrimColor | Optional [Color](/jetpack-compose/androidx.compose.ui/ui-graphics/classes/Color) used for the scrim over the content composable during the swipe gesture. |
| backgroundKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == true. Provide the backgroundKey if your background content will be displayed as a foreground after the swipe animation ends (as is common when [SwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-material/components/SwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | Optional [key](/jetpack-compose/androidx.compose.runtime/runtime/composable-functions/key) which identifies the content currently composed in the `content` block when isBackground == false. See `backgroundKey`. |
| hasBackground | Optional [Boolean] used to indicate if the content has no background, in which case the swipe gesture is disabled (since there is no parent destination). |
| content | Slot for content, with the isBackground parameter enabling content to be displayed behind the foreground content - the background is normally hidden, is shown behind a scrim during the swipe gesture, and is shown without scrim once the finger passes the swipe-to-dismiss threshold. |