<h2 id="basicswipetodismissbox-state-modifier-backgroundkey-contentkey-userswipeenabled-content">BasicSwipeToDismissBox</h2>

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

```kotlin
@Composable
public fun BasicSwipeToDismissBox(
    state: SwipeToDismissBoxState,
    modifier: Modifier = Modifier,
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    userSwipeEnabled: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

[BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox) that handles the swipe-to-dismiss gesture. Takes a single slot for the
background (only displayed during the swipe gesture) and the foreground content.

Example of a [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox) with stateful composables:

Example of using [Modifier.edgeSwipeToDismiss] with [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox)

For more information, see the
[Swipe to dismiss](https://developer.android.com/training/wearables/components/swipe-to-dismiss)
guide.

To set the custom values of background scrim color and content scrim color, provide the
composition locals - [LocalSwipeToDismissBackgroundScrimColor](/jetpack-compose/androidx.wear.compose/compose-foundation/properties/LocalSwipeToDismissBackgroundScrimColor) and
[LocalSwipeToDismissContentScrimColor](/jetpack-compose/androidx.wear.compose/compose-foundation/properties/LocalSwipeToDismissContentScrimColor).

#### Parameters

| | |
| --- | --- |
| state | [State](/jetpack-compose/androidx.compose.runtime/runtime/interfaces/State) containing information about ongoing swipe or animation. |
| modifier | [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| backgroundKey | [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 [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | [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`. |
| userSwipeEnabled | Whether the swipe gesture is enabled. (e.g. when there is no background screen, set userSwipeEnabled = false) |
| 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="basicswipetodismissbox-ondismissed-modifier-state-backgroundkey-contentkey-userswipeenabled-content">BasicSwipeToDismissBox</h2>

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

```kotlin
@Composable
public fun BasicSwipeToDismissBox(
    onDismissed: () -> Unit,
    modifier: Modifier = Modifier,
    state: SwipeToDismissBoxState = rememberSwipeToDismissBoxState(),
    backgroundKey: Any = SwipeToDismissKeys.Background,
    contentKey: Any = SwipeToDismissKeys.Content,
    userSwipeEnabled: Boolean = true,
    content: @Composable BoxScope.(isBackground: Boolean) -> Unit,
)
```

[BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox) that handles the swipe-to-dismiss gesture. This overload takes an
`onDismissed` parameter which is used to execute a command when the swipe to dismiss has
completed, such as navigating to another screen.

Example of a simple SwipeToDismissBox:

Example of using [Modifier.edgeSwipeToDismiss] with [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox)

For more information, see the
[Swipe to dismiss](https://developer.android.com/training/wearables/components/swipe-to-dismiss)
guide.

To set the custom values of background scrim color and content scrim color, provide the
composition locals - [LocalSwipeToDismissBackgroundScrimColor](/jetpack-compose/androidx.wear.compose/compose-foundation/properties/LocalSwipeToDismissBackgroundScrimColor) and
[LocalSwipeToDismissContentScrimColor](/jetpack-compose/androidx.wear.compose/compose-foundation/properties/LocalSwipeToDismissContentScrimColor).

#### Parameters

| | |
| --- | --- |
| onDismissed | Executes when the swipe to dismiss has completed. |
| modifier | [Modifier](/jetpack-compose/androidx.compose.ui/ui/interfaces/Modifier) for this component. |
| state | [State](/jetpack-compose/androidx.compose.runtime/runtime/interfaces/State) containing information about ongoing swipe or animation. |
| backgroundKey | [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 [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox) is used for the navigation). This allows remembered state to be correctly moved between background and foreground. |
| contentKey | [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`. |
| userSwipeEnabled | Whether the swipe gesture is enabled. (e.g. when there is no background screen, set userSwipeEnabled = false) |
| 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. |