<h2 id="anchoreddraggable-state-reversedirection-orientation-enabled-interactionsource-overscrolleffect-flingbehavior">anchoredDraggable</h2>

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

```kotlin
fun <T> Modifier.anchoredDraggable(
    state: AnchoredDraggableState<T>,
    reverseDirection: Boolean,
    orientation: Orientation,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    overscrollEffect: OverscrollEffect? = null,
    flingBehavior: FlingBehavior? = null,
): Modifier
```

Enable drag gestures between a set of predefined values.

When a drag is detected, the offset of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will be updated with the drag
delta. You should use this offset to move your content accordingly (see [Modifier.offset]). When
the drag ends, the offset will be animated to one of the anchors and when that anchor is reached,
the value of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will also be updated to the value corresponding to the
new anchor.

Dragging is constrained between the minimum and maximum anchors.

#### Parameters

| | |
| --- | --- |
| state | The associated [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState). |
| reverseDirection | Whether to reverse the direction of the drag, so a top to bottom drag will behave like bottom to top, and a left to right drag will behave like right to left. If not specified, this will be determined based on [orientation](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation) and [LocalLayoutDirection](/jetpack-compose/androidx.compose.ui/ui/properties/LocalLayoutDirection) through the other [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) overload. |
| orientation | The orientation in which the [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) can be dragged. |
| enabled | Whether this [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) is enabled and should react to the user's input. |
| interactionSource | Optional [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) that will passed on to the internal [Modifier.draggable]. |
| overscrollEffect | optional effect to dispatch any excess delta or velocity to. The excess delta or velocity are a result of dragging/flinging and reaching the bounds. If you provide an [overscrollEffect](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/OverscrollEffect), make sure to apply [androidx.compose.foundation.overscroll] to render the effect as well. |
| flingBehavior | Optionally configure how the anchored draggable performs the fling. By default (if passing in null), this will snap to the closest anchor considering the velocity thresholds and positional thresholds. See [AnchoredDraggableDefaults.flingBehavior]. |

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

> **Deprecated** StartDragImmediatelyDeprecated

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

<h2 id="anchoreddraggable-state-reversedirection-orientation-enabled-interactionsource-overscrolleffect-startdragimmediately-flingbehavior">anchoredDraggable</h2>

```kotlin
fun <T> Modifier.anchoredDraggable(
    state: AnchoredDraggableState<T>,
    reverseDirection: Boolean,
    orientation: Orientation,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    overscrollEffect: OverscrollEffect? = null,
    startDragImmediately: Boolean = state.isAnimationRunning,
    flingBehavior: FlingBehavior? = null,
): Modifier
```

Enable drag gestures between a set of predefined values.

When a drag is detected, the offset of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will be updated with the drag
delta. You should use this offset to move your content accordingly (see [Modifier.offset]). When
the drag ends, the offset will be animated to one of the anchors and when that anchor is reached,
the value of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will also be updated to the value corresponding to the
new anchor.

Dragging is constrained between the minimum and maximum anchors.

#### Parameters

| | |
| --- | --- |
| state | The associated [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState). |
| reverseDirection | Whether to reverse the direction of the drag, so a top to bottom drag will behave like bottom to top, and a left to right drag will behave like right to left. If not specified, this will be determined based on [orientation](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation) and [LocalLayoutDirection](/jetpack-compose/androidx.compose.ui/ui/properties/LocalLayoutDirection) through the other [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) overload. |
| orientation | The orientation in which the [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) can be dragged. |
| enabled | Whether this [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) is enabled and should react to the user's input. |
| interactionSource | Optional [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) that will passed on to the internal [Modifier.draggable]. |
| overscrollEffect | optional effect to dispatch any excess delta or velocity to. The excess delta or velocity are a result of dragging/flinging and reaching the bounds. If you provide an [overscrollEffect](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/OverscrollEffect), make sure to apply [androidx.compose.foundation.overscroll] to render the effect as well. |
| startDragImmediately | when set to false, [draggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/draggable) will start dragging only when the gesture crosses the touchSlop. This is useful to prevent users from "catching" an animating widget when pressing on it. See [draggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/draggable) to learn more about startDragImmediately. |
| flingBehavior | Optionally configure how the anchored draggable performs the fling. By default (if passing in null), this will snap to the closest anchor considering the velocity thresholds and positional thresholds. See [AnchoredDraggableDefaults.flingBehavior]. |

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

<h2 id="anchoreddraggable-state-orientation-enabled-interactionsource-overscrolleffect-flingbehavior">anchoredDraggable</h2>

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

```kotlin
fun <T> Modifier.anchoredDraggable(
    state: AnchoredDraggableState<T>,
    orientation: Orientation,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    overscrollEffect: OverscrollEffect? = null,
    flingBehavior: FlingBehavior? = null,
): Modifier
```

Enable drag gestures between a set of predefined values.

When a drag is detected, the offset of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will be updated with the drag
delta. If the [orientation](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation) is set to [Orientation.Horizontal](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation.Horizontal) and [LocalLayoutDirection](/jetpack-compose/androidx.compose.ui/ui/properties/LocalLayoutDirection)'s value
is [LayoutDirection.Rtl](/jetpack-compose/androidx.compose.ui/ui-unit/classes/LayoutDirection.Rtl), the drag deltas will be reversed. You should use this offset to move
your content accordingly (see [Modifier.offset]). When the drag ends, the offset will be animated
to one of the anchors and when that anchor is reached, the value of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState)
will also be updated to the value corresponding to the new anchor.

Dragging is constrained between the minimum and maximum anchors.

#### Parameters

| | |
| --- | --- |
| state | The associated [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState). |
| orientation | The orientation in which the [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) can be dragged. |
| enabled | Whether this [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) is enabled and should react to the user's input. |
| interactionSource | Optional [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) that will passed on to the internal [Modifier.draggable]. |
| overscrollEffect | optional effect to dispatch any excess delta or velocity to. The excess delta or velocity are a result of dragging/flinging and reaching the bounds. If you provide an [overscrollEffect](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/OverscrollEffect), make sure to apply [androidx.compose.foundation.overscroll] to render the effect as well. |
| flingBehavior | Optionally configure how the anchored draggable performs the fling. By default (if passing in null), this will snap to the closest anchor considering the velocity thresholds and positional thresholds. See [AnchoredDraggableDefaults.flingBehavior]. |

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

> **Deprecated** StartDragImmediatelyDeprecated

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

<h2 id="anchoreddraggable-state-orientation-enabled-interactionsource-overscrolleffect-startdragimmediately-flingbehavior">anchoredDraggable</h2>

```kotlin
fun <T> Modifier.anchoredDraggable(
    state: AnchoredDraggableState<T>,
    orientation: Orientation,
    enabled: Boolean = true,
    interactionSource: MutableInteractionSource? = null,
    overscrollEffect: OverscrollEffect? = null,
    startDragImmediately: Boolean = state.isAnimationRunning,
    flingBehavior: FlingBehavior? = null,
): Modifier
```

Enable drag gestures between a set of predefined values.

When a drag is detected, the offset of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState) will be updated with the drag
delta. If the [orientation](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation) is set to [Orientation.Horizontal](/jetpack-compose/androidx.compose.foundation/foundation/classes/Orientation.Horizontal) and [LocalLayoutDirection](/jetpack-compose/androidx.compose.ui/ui/properties/LocalLayoutDirection)'s value
is [LayoutDirection.Rtl](/jetpack-compose/androidx.compose.ui/ui-unit/classes/LayoutDirection.Rtl), the drag deltas will be reversed. You should use this offset to move
your content accordingly (see [Modifier.offset]). When the drag ends, the offset will be animated
to one of the anchors and when that anchor is reached, the value of the [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState)
will also be updated to the value corresponding to the new anchor.

Dragging is constrained between the minimum and maximum anchors.

#### Parameters

| | |
| --- | --- |
| state | The associated [AnchoredDraggableState](/jetpack-compose/androidx.compose.foundation/foundation/classes/AnchoredDraggableState). |
| orientation | The orientation in which the [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) can be dragged. |
| enabled | Whether this [anchoredDraggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/anchoredDraggable) is enabled and should react to the user's input. |
| interactionSource | Optional [MutableInteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/MutableInteractionSource) that will passed on to the internal [Modifier.draggable]. |
| overscrollEffect | optional effect to dispatch any excess delta or velocity to. The excess delta or velocity are a result of dragging/flinging and reaching the bounds. If you provide an [overscrollEffect](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/OverscrollEffect), make sure to apply [androidx.compose.foundation.overscroll] to render the effect as well. |
| startDragImmediately | when set to false, [draggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/draggable) will start dragging only when the gesture crosses the touchSlop. This is useful to prevent users from "catching" an animating widget when pressing on it. See [draggable](/jetpack-compose/androidx.compose.foundation/foundation/modifiers/draggable) to learn more about startDragImmediately. |
| flingBehavior | Optionally configure how the anchored draggable performs the fling. By default (if passing in null), this will snap to the closest anchor considering the velocity thresholds and positional thresholds. See [AnchoredDraggableDefaults.flingBehavior]. |