---
title: "SwipeToDismissBoxState"
description: "State for [BasicSwipeToDismissBox]."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

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


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


State for `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

```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.


```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



