# ScrollableState

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/ScrollableState.kt+class:androidx.compose.foundation.gestures.ScrollableState) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface ScrollableState
  ```
Known direct subclasses [ButtonGroupState](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/ButtonGroupState), [CarouselState](https://developer.android.com/reference/kotlin/androidx/compose/material3/carousel/CarouselState), [GlimmerLazyListState](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/list/GlimmerLazyListState), [GlimmerPagerState](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/pager/GlimmerPagerState), [LazyGridState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState), [LazyListState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState), [LazyStaggeredGridState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState), [PagerState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/pager/PagerState), [PagerState](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/pager/PagerState), [PickerState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PickerState), [PickerState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/PickerState), [ScalingLazyListState](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListState), [ScalingLazyListState](https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState), [ScrollState](https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollState), [StackState](https://developer.android.com/reference/kotlin/androidx/xr/glimmer/stack/StackState), [TransformingLazyColumnState](https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnState)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/ButtonGroupState` | A state object that allows querying and controlling the state of a `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/ButtonGroup.composable#ButtonGroup(androidx.compose.ui.Modifier,androidx.xr.glimmer.ButtonGroupState,androidx.compose.foundation.layout.Arrangement.Horizontal,androidx.compose.ui.Alignment.Vertical,androidx.compose.foundation.layout.PaddingValues,kotlin.Function0)` component. |
| `https://developer.android.com/reference/kotlin/androidx/compose/material3/carousel/CarouselState` | The state that can be used to control all types of carousels. |
| `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/list/GlimmerLazyListState` | A state object that can be hoisted to control and observe scrolling. |
| `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/pager/GlimmerPagerState` | The state that can be used to control `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/pager/GlimmerHorizontalPager.composable#GlimmerHorizontalPager(androidx.xr.glimmer.pager.GlimmerPagerState,androidx.compose.ui.Modifier,androidx.compose.foundation.layout.PaddingValues,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.Alignment.Vertical,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,kotlin.Function0,kotlin.Function2)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/grid/LazyGridState` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` | A state object that can be hoisted to control and observe scrolling. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyStaggeredGridState` | Hoisted state object controlling `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyVerticalStaggeredGrid.composable#LazyVerticalStaggeredGrid(androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.ui.unit.Dp,androidx.compose.foundation.layout.Arrangement.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Function1)` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/staggeredgrid/LazyHorizontalStaggeredGrid.composable#LazyHorizontalStaggeredGrid(androidx.compose.foundation.lazy.staggeredgrid.StaggeredGridCells,androidx.compose.ui.Modifier,androidx.compose.foundation.lazy.staggeredgrid.LazyStaggeredGridState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.unit.Dp,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.lazy.layout.LazyLayoutCacheWindow,kotlin.Function1)`. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/pager/PagerState` | The state that can be used to control `https://developer.android.com/reference/kotlin/androidx/compose/foundation/pager/VerticalPager.composable#VerticalPager(androidx.compose.foundation.pager.PagerState,androidx.compose.ui.Modifier,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.pager.PageSize,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.TargetedFlingBehavior,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,androidx.compose.ui.input.nestedscroll.NestedScrollConnection,androidx.compose.foundation.gestures.snapping.SnapPosition,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.gestures.BringIntoViewSpec,kotlin.Function2)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/pager/HorizontalPager.composable#HorizontalPager(androidx.compose.foundation.pager.PagerState,androidx.compose.ui.Modifier,androidx.compose.foundation.layout.PaddingValues,androidx.compose.foundation.pager.PageSize,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.Alignment.Vertical,androidx.compose.foundation.gestures.TargetedFlingBehavior,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,androidx.compose.ui.input.nestedscroll.NestedScrollConnection,androidx.compose.foundation.gestures.snapping.SnapPosition,androidx.compose.foundation.OverscrollEffect,androidx.compose.foundation.gestures.BringIntoViewSpec,kotlin.Function2)` |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/pager/PagerState` | The state that can be used in conjunction with Wear `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/pager/HorizontalPager.composable#HorizontalPager(androidx.wear.compose.foundation.pager.PagerState,androidx.compose.ui.Modifier,androidx.compose.foundation.layout.PaddingValues,kotlin.Int,androidx.compose.foundation.gestures.TargetedFlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.GestureInclusion,kotlin.Boolean,kotlin.Function1,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,kotlin.Function2)` and `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/pager/VerticalPager.composable#VerticalPager(androidx.wear.compose.foundation.pager.PagerState,androidx.compose.ui.Modifier,androidx.compose.foundation.layout.PaddingValues,kotlin.Int,androidx.compose.foundation.gestures.TargetedFlingBehavior,kotlin.Boolean,kotlin.Boolean,kotlin.Function1,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,kotlin.Function2)`. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/PickerState` | A state object that can be hoisted to observe item selection. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material3/PickerState` | A state object that can be hoisted to observe item selection. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/ScalingLazyListState` | A state object that can be hoisted to control and observe scrolling. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/material/ScalingLazyListState` | **This class is deprecated.** Was moved to androidx.wear.compose.foundation.lazy package. |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollState` | State of the scroll. |
| `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/stack/StackState` | The `https://developer.android.com/reference/kotlin/androidx/xr/glimmer/stack/VerticalStack.composable#VerticalStack(androidx.compose.ui.Modifier,androidx.xr.glimmer.stack.StackState,kotlin.Function1)` state that allows programmatic control and observation of the stack's state. |
| `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumnState` | A state object that can be hoisted to control and observe scrolling in a `https://developer.android.com/reference/kotlin/androidx/wear/compose/foundation/lazy/TransformingLazyColumn.composable#TransformingLazyColumn(androidx.compose.ui.Modifier,androidx.wear.compose.foundation.lazy.TransformingLazyColumnState,androidx.compose.foundation.layout.PaddingValues,kotlin.Boolean,androidx.compose.foundation.layout.Arrangement.Vertical,androidx.compose.ui.Alignment.Horizontal,androidx.compose.foundation.gestures.FlingBehavior,kotlin.Boolean,androidx.wear.compose.foundation.rotary.RotaryScrollableBehavior,androidx.compose.foundation.OverscrollEffect,androidx.wear.compose.foundation.lazy.TransformingLazyColumnFirstLayoutItemProvider,kotlin.Function1)`. |

*** ** * ** ***

An object representing something that can be scrolled. This interface is implemented by states of scrollable containers such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState` or `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollState` in order to provide low-level scrolling control via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)`, as well as allowing for higher-level scrolling functions like `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)` to be implemented as extension functions on `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState`.

Subclasses may also have their own methods that are specific to their interaction paradigm, such as `https://developer.android.com/reference/kotlin/androidx/compose/foundation/lazy/LazyListState#scrollToItem(kotlin.Int,kotlin.Int)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)` |   |
| `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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#dispatchRawDelta(kotlin.Float)(delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Dispatch scroll delta in pixels avoiding all scroll related mechanisms. | Cmn |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)(scrollPriority: https://developer.android.com/reference/kotlin/androidx/compose/foundation/MutatePriority, block: suspend https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Call this function to take control of scrolling and gain the ability to send scroll events via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollScope#scrollBy(kotlin.Float)`. | Cmn |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#canScrollBackward()` Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` can scroll backward (consume a negative delta). | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#canScrollForward()` Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` can scroll forward (consume a positive delta). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#isScrollInProgress()` Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` is currently scrolling by gesture, fling or programmatically or not. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#lastScrolledBackward()` The value of this property is true under the following scenarios, otherwise it's false. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#lastScrolledForward()` The value of this property is true under the following scenarios, otherwise it's false. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState?` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scrollIndicatorState()` `https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState` used for drawing a scroll indicator (e.g., a scrollbar). | Cmn |

| ### Extension functions |
|---|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState.https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)( value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> )` Scroll by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)` pixels with animation. | Cmn |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState.https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#(androidx.compose.foundation.gestures.ScrollableState).scrollBy(kotlin.Float)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Jump instantly by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).scrollBy(kotlin.Float)` pixels. | Cmn |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState.https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#(androidx.compose.foundation.gestures.ScrollableState).stopScroll(androidx.compose.foundation.MutatePriority)(scrollPriority: https://developer.android.com/reference/kotlin/androidx/compose/foundation/MutatePriority)` Stop and suspend until any ongoing animation, smooth scrolling, fling, or any other scroll occurring via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` is terminated. | Cmn |

## Public functions

### dispatchRawDelta

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

```
fun dispatchRawDelta(delta: Float): Float
```

Dispatch scroll delta in pixels avoiding all scroll related mechanisms.

**NOTE:** unlike `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)`, dispatching any delta with this method won't trigger nested scroll, won't stop ongoing scroll/drag animation and will bypass scrolling of any priority. This method will also ignore `reverseDirection` and other parameters set in scrollable.

This method is used internally for nested scrolling dispatch and other low level operations, allowing implementers of `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` influence the consumption as suits them. Manually dispatching delta via this method will likely result in a bad user experience, you must prefer `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` method over this one.

| Parameters |
|---|---|
| `delta: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | amount of scroll dispatched in the nested scroll process |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the amount of delta consumed |

### scroll

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

```
suspend fun scroll(
    scrollPriority: MutatePriority = MutatePriority.Default,
    block: suspend ScrollScope.() -> Unit
): Unit
```

Call this function to take control of scrolling and gain the ability to send scroll events via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollScope#scrollBy(kotlin.Float)`. All actions that change the logical scroll position must be performed within a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` block (even if they don't call any other methods on this object) in order to guarantee that mutual exclusion is enforced.

If `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` is called from elsewhere with the `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` higher or equal to ongoing scroll, ongoing scroll will be canceled.

## Public properties

### canScrollBackward

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

```
open val canScrollBackward: Boolean
```

Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` can scroll backward (consume a negative delta). This is typically false if the scroll position is equal to its minimum value, and true otherwise.

Note that `true` here does not imply that delta *will* be consumed - the ScrollableState may decide not to handle the incoming delta (such as if it is already being scrolled separately). Additionally, for backwards compatibility with previous versions of ScrollableState this value defaults to `true`.

```kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer

val state = rememberLazyListState()
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
    Icon(
        Icons.Filled.KeyboardArrowUp,
        null,
        Modifier.graphicsLayer {
            // Hide the icon if we cannot scroll backward (we are the start of the list)
            // We use graphicsLayer here to control the alpha so that we only redraw when this
            // value changes, instead of recomposing
            alpha = if (state.canScrollBackward) 1f else 0f
        },
        Color.Red,
    )
    val items = (1..100).toList()
    LazyColumn(Modifier.weight(1f).fillMaxWidth(), state) {
        items(items) { Text("Item is $it") }
    }
    Icon(
        Icons.Filled.KeyboardArrowDown,
        null,
        Modifier.graphicsLayer {
            // Hide the icon if we cannot scroll forward (we are the end of the list)
            // We use graphicsLayer here to control the alpha so that we only redraw when this
            // value changes, instead of recomposing
            alpha = if (state.canScrollForward) 1f else 0f
        },
        Color.Red,
    )
}
```

### canScrollForward

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

```
open val canScrollForward: Boolean
```

Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` can scroll forward (consume a positive delta). This is typically false if the scroll position is equal to its maximum value, and true otherwise.

Note that `true` here does not imply that delta *will* be consumed - the ScrollableState may decide not to handle the incoming delta (such as if it is already being scrolled separately). Additionally, for backwards compatibility with previous versions of ScrollableState this value defaults to `true`.

```kotlin
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowDown
import androidx.compose.material.icons.filled.KeyboardArrowUp
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer

val state = rememberLazyListState()
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
    Icon(
        Icons.Filled.KeyboardArrowUp,
        null,
        Modifier.graphicsLayer {
            // Hide the icon if we cannot scroll backward (we are the start of the list)
            // We use graphicsLayer here to control the alpha so that we only redraw when this
            // value changes, instead of recomposing
            alpha = if (state.canScrollBackward) 1f else 0f
        },
        Color.Red,
    )
    val items = (1..100).toList()
    LazyColumn(Modifier.weight(1f).fillMaxWidth(), state) {
        items(items) { Text("Item is $it") }
    }
    Icon(
        Icons.Filled.KeyboardArrowDown,
        null,
        Modifier.graphicsLayer {
            // Hide the icon if we cannot scroll forward (we are the end of the list)
            // We use graphicsLayer here to control the alpha so that we only redraw when this
            // value changes, instead of recomposing
            alpha = if (state.canScrollForward) 1f else 0f
        },
        Color.Red,
    )
}
```

### isScrollInProgress

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

```
val isScrollInProgress: Boolean
```

Whether this `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` is currently scrolling by gesture, fling or programmatically or not.

### lastScrolledBackward

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

```
open val lastScrolledBackward: Boolean
```

The value of this property is true under the following scenarios, otherwise it's false.

- This `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` is currently scrolling backward.

- This `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` was scrolling backward in its last scroll action.

### lastScrolledForward

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

```
open val lastScrolledForward: Boolean
```

The value of this property is true under the following scenarios, otherwise it's false.

- This `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` is currently scrolling forward.

- This `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState` was scrolling forward in its last scroll action.

### scrollIndicatorState

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

```
open val scrollIndicatorState: ScrollIndicatorState?
```

`https://developer.android.com/reference/kotlin/androidx/compose/foundation/ScrollIndicatorState` used for drawing a scroll indicator (e.g., a scrollbar).

This property may be `null` if scroll indicators are not applicable or if the underlying scrollable component does not support or provide this state.

## Extension functions

### ScrollableState.animateScrollBy

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/ScrollExtensions.kt+function:animateScrollBy)

```
suspend fun ScrollableState.animateScrollBy(
    value: Float,
    animationSpec: AnimationSpec<Float> = spring()
): Float
```

Scroll by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)` pixels with animation.

Cancels the currently running scroll, if any, and suspends until the cancellation is complete.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | number of pixels to scroll by |
| `animationSpec: https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html> = spring()` | `https://developer.android.com/reference/kotlin/androidx/compose/animation/core/AnimationSpec` to be used for this scrolling |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the amount of scroll consumed |

### ScrollableState.scrollBy

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/ScrollExtensions.kt+function:scrollBy)

```
suspend fun ScrollableState.scrollBy(value: Float): Float
```

Jump instantly by `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).scrollBy(kotlin.Float)` pixels.

Cancels the currently running scroll, if any, and suspends until the cancellation is complete.

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | number of pixels to scroll by |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the amount of scroll consumed |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/package-summary#(androidx.compose.foundation.gestures.ScrollableState).animateScrollBy(kotlin.Float,androidx.compose.animation.core.AnimationSpec)` | for an animated version |

### ScrollableState.stopScroll

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/ScrollExtensions.kt+function:stopScroll)

```
suspend fun ScrollableState.stopScroll(
    scrollPriority: MutatePriority = MutatePriority.Default
): Unit
```

Stop and suspend until any ongoing animation, smooth scrolling, fling, or any other scroll occurring via `https://developer.android.com/reference/kotlin/androidx/compose/foundation/gestures/ScrollableState#scroll(androidx.compose.foundation.MutatePriority,kotlin.coroutines.SuspendFunction1)` is terminated.

| Parameters |
|---|---|
| `scrollPriority: https://developer.android.com/reference/kotlin/androidx/compose/foundation/MutatePriority = MutatePriority.Default` | scrolls that run with this priority or lower will be stopped |