---
title: "GlimmerLazyListState"
description: "A state object that can be hoisted to control and observe scrolling."
type: "class"
lastmod: "2026-05-20T01:13:52.900296Z"
---
## API Reference

> Source set: Android

```kotlin
public class GlimmerLazyListState(
    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 [rememberGlimmerLazyListState](/jetpack-compose/androidx.xr.glimmer/glimmer/composable-functions/rememberGlimmerLazyListState).

#### Parameters

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

## Properties

### firstVisibleItemIndex

> Source set: Android

```kotlin
public val firstVisibleItemIndex: Int
```

The index of the first item that is visible within the scrollable viewport area not including
items in the content padding region. For the first visible item that includes items in the
content padding please use [GlimmerLazyListLayoutInfo.visibleItemsInfo](/jetpack-compose/androidx.xr.glimmer/glimmer/interfaces/GlimmerLazyListLayoutInfo).

Note that this property is observable and if you use it in the composable function it will be
recomposed on every change causing potential performance issues.

### firstVisibleItemScrollOffset

> Source set: Android

```kotlin
public val firstVisibleItemScrollOffset: Int
```

The scroll offset of the first visible item. Scrolling forward is positive - i.e., the amount
that the item is offset backwards.

Note that this property is observable and if you use it in the composable function it will be
recomposed on every scroll causing potential performance issues.

### layoutInfo

> Source set: Android

```kotlin
public val layoutInfo: GlimmerLazyListLayoutInfo
```

The object of [GlimmerLazyListLayoutInfo](/jetpack-compose/androidx.xr.glimmer/glimmer/interfaces/GlimmerLazyListLayoutInfo) calculated during the last layout pass. For
example, you can use it to calculate what items are currently visible.

Note that this property is observable and is updated after every scroll or remeasure. If you
use it in the composable function it will be recomposed on every change causing potential
performance issues including infinity recomposition loop. Therefore, avoid using it in the
composition.

If you want to run some side effects like sending an analytics event or updating a state
based on this value consider using "snapshotFlow":

### interactionSource

> Source set: Android

```kotlin
public val interactionSource: InteractionSource
```

[InteractionSource](/jetpack-compose/androidx.compose.foundation/foundation/interfaces/InteractionSource) that will be used to dispatch drag events when this list is being
dragged. If you want to know whether the fling (or animated scroll) is in progress, use
`isScrollInProgress`.

## Functions

### scrollToItem

```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). |

### animateScrollToItem

```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

> Source set: Android

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

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