# SwipeToDismissBoxState

Artifact: [androidx.wear.compose:compose-material](https://developer.android.com/jetpack/androidx/releases/wear-compose) [View Source](https://cs.android.com/search?q=file:androidx/wear/compose/material/SwipeToDismissBox.kt+class:androidx.wear.compose.material.SwipeToDismissBoxState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)


```
class SwipeToDismissBoxState
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

State for `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBox.composable#SwipeToDismissBox(androidx.wear.compose.foundation.SwipeToDismissBoxState,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,kotlin.Any,kotlin.Any,kotlin.Boolean,kotlin.Function2)`.

## Summary

| ### Public constructors |
|---|
| `[SwipeToDismissBoxState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#SwipeToDismissBoxState(androidx.compose.animation.core.AnimationSpec,kotlin.Function1))( animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>, confirmStateChange: (https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` **This function is deprecated.** SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation. |

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[snapTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#snapTo(androidx.wear.compose.material.SwipeToDismissValue))(targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue)` **This function is deprecated.** SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#currentValue()` **This property is deprecated.** SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#isAnimationRunning()` **This property is deprecated.** SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue` | `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#targetValue()` **This property is deprecated.** SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation. |

## Public constructors

### SwipeToDismissBoxState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
[SwipeToDismissBoxState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#SwipeToDismissBoxState(androidx.compose.animation.core.AnimationSpec,kotlin.Function1))(
    animationSpec: AnimationSpec<Float> = SwipeToDismissBoxDefaults.AnimationSpec,
    confirmStateChange: (SwipeToDismissValue) -> Boolean = { true }
)
```

> [!CAUTION]
> **This function is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

| Parameters |
|---|---|
| `animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> = SwipeToDismissBoxDefaults.AnimationSpec` | The default animation that will be used to animate to a new state. |
| `confirmStateChange: (https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = { true }` | Optional callback invoked to confirm or veto a pending state change. |

## Public functions

### snapTo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
suspend fun [snapTo](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#snapTo(androidx.wear.compose.material.SwipeToDismissValue))(targetValue: SwipeToDismissValue): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

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

| Parameters |
|---|---|
| `targetValue: https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue` | The new target value to set `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#currentValue()` to. |

## Public properties

### currentValue

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
val currentValue: SwipeToDismissValue
```

> [!CAUTION]
> **This property is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

The current value of the state.

Before and during a swipe, corresponds to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue#Default`, then switches to `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissValue#Dismissed` if the swipe has been completed.

### isAnimationRunning

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
val isAnimationRunning: Boolean
```

> [!CAUTION]
> **This property is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

Whether the state is currently animating.

### targetValue

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.0.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/wear-compose#1.4.0)

```
val targetValue: SwipeToDismissValue
```

> [!CAUTION]
> **This property is deprecated.**   
> SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

The target value of the state.

If a swipe is in progress, this is the value that the state would animate to if the swipe finished. If an animation is running, this is the target value of that animation. Finally, if no swipe or animation is in progress, this is the same as the `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/SwipeToDismissBoxState#currentValue()`.