# ScrollableDefaults

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/gestures/Scrollable.kt+class:androidx.compose.foundation.gestures.ScrollableDefaults) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  object ScrollableDefaults
  ```

*** ** * ** ***

Contains the default values used by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/scrollable.modifier#(androidx.compose.ui.Modifier).scrollable(androidx.compose.foundation.gestures.ScrollableState,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.gestures.FlingBehavior,androidx.compose.foundation.interaction.MutableInteractionSource)`

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/FlingBehavior` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableDefaults#flingBehavior()()` Create and remember default `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/FlingBehavior` that will represent a natural fling curve. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/OverscrollEffect` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable [overscrollEffect](https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableDefaults#overscrollEffect())()` **This function is deprecated.** This API has been replaced with rememberOverscrollEffect, which queries theme provided OverscrollFactory values instead of the 'platform default' without customization. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableDefaults#reverseDirection(androidx.compose.ui.unit.LayoutDirection,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean)( layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection, orientation: https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Orientation, reverseScrolling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` Calculates the final `reverseDirection` value for a scrollable component. | Cmn |

## Public functions

### flingBehavior

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

```
@Composable
fun flingBehavior(): FlingBehavior
```

Create and remember default `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/FlingBehavior` that will represent a natural fling curve.

### overscrollEffect

Cmn Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.2.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.8.0)

```
@Composable
fun [overscrollEffect](https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableDefaults#overscrollEffect())(): OverscrollEffect
```

> [!CAUTION]
> **This function is deprecated.**   
> This API has been replaced with rememberOverscrollEffect, which queries theme provided OverscrollFactory values instead of the 'platform default' without customization, use this instead:
>
> ```kotlin
> rememberOverscrollEffect()
> ```

Returns a remembered `https://developer.android.com/reference/kotlin/androidx/compose/foundation/OverscrollEffect` created from the current value of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/package-summary#LocalOverscrollFactory()`.

This API has been deprecated, and replaced with `https://developer.android.com/reference/kotlin/androidx/compose/foundation/rememberOverscrollEffect.composable#rememberOverscrollEffect()`

### reverseDirection

Cmn Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.3.0)

```
fun reverseDirection(
    layoutDirection: LayoutDirection,
    orientation: Orientation,
    reverseScrolling: Boolean
): Boolean
```

Calculates the final `reverseDirection` value for a scrollable component.

This is a helper function used by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/scrollableArea.modifier#(androidx.compose.ui.Modifier).scrollableArea(androidx.compose.foundation.gestures.ScrollableState,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.gestures.FlingBehavior,androidx.compose.foundation.interaction.MutableInteractionSource,androidx.compose.foundation.gestures.BringIntoViewSpec)` to determine whether to reverse the direction of scroll input. The goal is to provide a "natural" scrolling experience where content moves with the user's gesture, while also accounting for the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableDefaults#reverseDirection(androidx.compose.ui.unit.LayoutDirection,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean)`.

The logic is as follows:

1. To achieve "natural" scrolling (content moves with the gesture), scroll deltas are inverted. This function returns `true` by default when `reverseScrolling` is `false`.

2. In a Right-to-Left (`Rtl`) context with a `Horizontal` orientation, the direction is flipped an additional time to maintain the natural feel, as the content is laid out from right to left.

| Parameters |
|---|---|
| `layoutDirection: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/LayoutDirection` | current layout direction (e.g., from `https://developer.android.com/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalLayoutDirection()`) |
| `orientation: https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Orientation` | orientation of scroll |
| `reverseScrolling: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | whether scrolling direction should be reversed |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if scroll direction should be reversed, `false` otherwise. |