<div class='sourceset sourceset-common'>Common</div>

> **Deprecated** ConfigurationMovedToModifier

<h2 id="anchoreddraggablestate-initialvalue-positionalthreshold-velocitythreshold-snapanimationspec-decayanimationspec-confirmvaluechange">AnchoredDraggableState</h2>

```kotlin
fun <T> AnchoredDraggableState(
    initialValue: T,
    positionalThreshold: (totalDistance: Float) -> Float,
    velocityThreshold: () -> Float,
    snapAnimationSpec: AnimationSpec<Float>,
    decayAnimationSpec: DecayAnimationSpec<Float>,
    confirmValueChange: (newValue: T) -> Boolean = { true },
): AnchoredDraggableState<T>
```

State of the [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState) modifier. Use the constructor overload with anchors if the
anchors are defined in composition, or update the anchors using
[AnchoredDraggableState.updateAnchors](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState).

This contains necessary information about any ongoing drag or animation and provides methods to
change the state either immediately or by starting an animation.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. |
| positionalThreshold | The positional threshold, in px, to be used when calculating the target state while a drag is in progress and when settling after the drag 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. |
| velocityThreshold | The velocity threshold (in px per second) that the end velocity has to exceed in order to animate to the next state, even if the [positionalThreshold](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState) has not been reached. |
| confirmValueChange | Optional callback invoked to confirm or veto a pending state change. |

<div class='sourceset sourceset-common'>Common</div>

> **Deprecated** ConfigurationMovedToModifier

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

<h2 id="anchoreddraggablestate-initialvalue-anchors-positionalthreshold-velocitythreshold-snapanimationspec-decayanimationspec-confirmvaluechange">AnchoredDraggableState</h2>

```kotlin
fun <T> AnchoredDraggableState(
    initialValue: T,
    anchors: DraggableAnchors<T>,
    positionalThreshold: (totalDistance: Float) -> Float,
    velocityThreshold: () -> Float,
    snapAnimationSpec: AnimationSpec<Float>,
    decayAnimationSpec: DecayAnimationSpec<Float>,
    confirmValueChange: (newValue: T) -> Boolean = { true },
): AnchoredDraggableState<T>
```

Construct an [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState) instance with anchors.

#### Parameters

| | |
| --- | --- |
| initialValue | The initial value of the state. |
| anchors | The anchors of the state. Use [AnchoredDraggableState.updateAnchors](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState) to update the anchors later. |
| snapAnimationSpec | The default animation spec that will be used to animate to a new state. |
| decayAnimationSpec | The animation spec that will be used when flinging with a large enough velocity to reach or cross the target state. |
| confirmValueChange | Optional callback invoked to confirm or veto a pending state change. |
| positionalThreshold | The positional threshold, in px, to be used when calculating the target state while a drag is in progress and when settling after the drag 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. |
| velocityThreshold | The velocity threshold (in px per second) that the end velocity has to exceed in order to animate to the next state, even if the [positionalThreshold](/jetpack-compose/androidx.compose.foundation/foundation/functions/AnchoredDraggableState) has not been reached. |