# rememberSwipeToDismissBoxState

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxState` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material3/rememberSwipeToDismissBoxState.composable#rememberSwipeToDismissBoxState(androidx.compose.material3.SwipeToDismissBoxValue,kotlin.Function1)( initialValue: https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue, positionalThreshold: (totalDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Create and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/remember.composable#remember(kotlin.Function0)` a `https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxState`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxState` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [rememberSwipeToDismissBoxState](https://developer.android.com/reference/kotlin/androidx/compose/material3/rememberSwipeToDismissBoxState.composable#rememberSwipeToDismissBoxState(androidx.compose.material3.SwipeToDismissBoxValue,kotlin.Function1,kotlin.Function1))( initialValue: https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue, confirmValueChange: (https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, positionalThreshold: (totalDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` **This function is deprecated.** confirmValueChange is deprecated without replacement. | Cmn |

## Functions

### rememberSwipeToDismissBoxState

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/SwipeToDismissBox.kt+function:rememberSwipeToDismissBoxState)

```
@Composable
fun rememberSwipeToDismissBoxState(
    initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled,
    positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold
): SwipeToDismissBoxState
```

Create and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/remember.composable#remember(kotlin.Function0)` a `https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxState`.

| Parameters |
|---|---|
| `initialValue: https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled` | The initial value of the state. |
| `positionalThreshold: (totalDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = SwipeToDismissBoxDefaults.positionalThreshold` | The positional threshold to be used when calculating the target state while a swipe is in progress and when settling after the swipe ends. This is the distance from the start of a transition. It will be, depending on the direction of the interaction, added or subtracted from/to the origin offset. It should always be a positive value. |

### rememberSwipeToDismissBoxState

Cmn Artifact: [androidx.compose.material3:material3](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/SwipeToDismissBox.kt+function:rememberSwipeToDismissBoxState)

```
@Composable
fun [rememberSwipeToDismissBoxState](https://developer.android.com/reference/kotlin/androidx/compose/material3/rememberSwipeToDismissBoxState.composable#rememberSwipeToDismissBoxState(androidx.compose.material3.SwipeToDismissBoxValue,kotlin.Function1,kotlin.Function1))(
    initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled,
    confirmValueChange: (SwipeToDismissBoxValue) -> Boolean = { true },
    positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold
): SwipeToDismissBoxState
```

> [!CAUTION]
> **This function is deprecated.**   
> confirmValueChange is deprecated without replacement. Rather than relying on a callback to veto state changes, the anchor set should not include disallowed anchors. See androidx.compose.foundation.samples.AnchoredDraggableDynamicAnchorsSample for an example of using dynamic anchors over confirmValueChange, use this instead:
>
> ```kotlin
> rememberSwipeToDismissBoxState(initialValue, positionalThreshold)
> ```

Create and `https://developer.android.com/reference/kotlin/androidx/compose/runtime/remember.composable#remember(kotlin.Function0)` a `https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxState`.

| Parameters |
|---|---|
| `initialValue: https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled` | The initial value of the state. |
| `confirmValueChange: (https://developer.android.com/reference/kotlin/androidx/compose/material3/SwipeToDismissBoxValue) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = { true }` | Optional callback invoked to confirm or veto a pending state change. |
| `positionalThreshold: (totalDistance: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = SwipeToDismissBoxDefaults.positionalThreshold` | The positional threshold to be used when calculating the target state while a swipe is in progress and when settling after the swipe ends. This is the distance from the start of a transition. It will be, depending on the direction of the interaction, added or subtracted from/to the origin offset. It should always be a positive value. |