# rememberScrollable2DState

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Scrollable2DState` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/rememberScrollable2DState.composable#rememberScrollable2DState(kotlin.Function1)(consumeScrollDelta: (https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset) -> https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Create and remember the default implementation of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Scrollable2DState` interface that contains necessary information about the ongoing fling and provides smooth scrolling capabilities. | Cmn |

## Functions

### rememberScrollable2DState

Cmn 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/Scrollable2DState.kt+function:rememberScrollable2DState) Added in [1.9.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.9.0)

```
@Composable
fun rememberScrollable2DState(consumeScrollDelta: (Offset) -> Offset): Scrollable2DState
```

Create and remember the default implementation of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Scrollable2DState` interface that contains necessary information about the ongoing fling and provides smooth scrolling capabilities.

This is the simplest way to set up a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/scrollable2D.modifier#(androidx.compose.ui.Modifier).scrollable2D(androidx.compose.foundation.gestures.Scrollable2DState,kotlin.Boolean,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.gestures.FlingBehavior,androidx.compose.foundation.interaction.MutableInteractionSource)` modifier. When constructing this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/Scrollable2DState`, you must provide a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#rememberScrollable2DState(kotlin.Function1)` lambda, which will be invoked whenever scroll happens (by gesture input, by smooth scrolling, by flinging or nested scroll) with the delta in pixels. The amount of scrolling delta consumed must be returned from this lambda to ensure proper nested scrolling behaviour.

| Parameters |
|---|---|
| `consumeScrollDelta: (https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset) -> https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset` | callback invoked when drag/fling/smooth scrolling occurs. The callback receives the delta in pixels. Callers should update their state in this lambda and return the amount of delta consumed |