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

```kotlin
public class SwipeToDismissBoxState(
    animationSpec: AnimationSpec<Float> = SwipeToDismissBoxDefaults.AnimationSpec,
    confirmStateChange: (SwipeToDismissValue) -> Boolean = { true },
)
```

State for [BasicSwipeToDismissBox](/jetpack-compose/androidx.wear.compose/compose-foundation/composable-functions/BasicSwipeToDismissBox).

#### Parameters

| | |
| --- | --- |
| animationSpec | The default animation that will be used to animate to a new state. |
| confirmStateChange | callback invoked to confirm or veto a pending state change. |

## Functions

<h2 id="requireoffset">requireOffset</h2>

```kotlin
public fun requireOffset(): Float
```

Require the current offset. This method should always be used instead of using the `offset`
field, unless the access to the uninitialised value is required.

The offset shows how far the foreground content was swiped from its original position.

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

<h2 id="snapto-targetvalue">snapTo</h2>

```kotlin
public suspend fun snapTo(targetValue: SwipeToDismissValue): Unit
```

Set the state without any animation and suspend until it's set

#### Parameters

| | |
| --- | --- |
| targetValue | The new target value to set `currentValue` to. |

## Companion Object