<div class='sourceset sourceset-android'>Android</div>

```kotlin
public class ListState(firstVisibleItemIndex: Int = 0, firstVisibleItemScrollOffset: Int = 0) :
    ScrollableState
```

A state object that can be hoisted to control and observe scrolling.

In most cases, this will be created via [rememberListState](/jetpack-compose/androidx.xr.glimmer/glimmer/composable-functions/rememberListState).

#### Parameters

| | |
| --- | --- |
| firstVisibleItemIndex | the initial value for [ListState.firstVisibleItemIndex](/jetpack-compose/androidx.xr.glimmer/glimmer/classes/ListState) |
| firstVisibleItemScrollOffset | the initial value for [ListState.firstVisibleItemScrollOffset](/jetpack-compose/androidx.xr.glimmer/glimmer/classes/ListState) |

## Functions

<h2 id="scrolltoitem-index-scrolloffset">scrollToItem</h2>

```kotlin
public suspend fun scrollToItem(@IntRange(from = 0) index: Int, scrollOffset: Int = 0)
```

Instantly brings the item at `index` to the top of the viewport, offset by `scrollOffset`
pixels.

#### Parameters

| | |
| --- | --- |
| index | the index to which to scroll. Must be non-negative. |
| scrollOffset | the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |

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

<h2 id="animatescrolltoitem-index-scrolloffset">animateScrollToItem</h2>

```kotlin
public suspend fun animateScrollToItem(@IntRange(from = 0) index: Int, scrollOffset: Int = 0)
```

Animate (smooth scroll) to the given item.

#### Parameters

| | |
| --- | --- |
| index | the index to which to scroll. Must be non-negative. |
| scrollOffset | the offset that the item should end up after the scroll. Note that positive offset refers to forward scroll, so in a top-to-bottom list, positive offset will scroll the item further upward (taking it partly offscreen). |

## Companion Object

#### Properties

<div class='sourceset sourceset-android'>Android</div>

```kotlin
public val Saver: Saver<ListState, Any>
```

The default [Saver](/jetpack-compose/androidx.compose.runtime/runtime-saveable/interfaces/Saver) implementation for [ListState](/jetpack-compose/androidx.xr.glimmer/glimmer/classes/ListState).