---
title: "ScrollFieldState"
description: "A state object that can be hoisted to observe and control the scrolling behavior of a ScrollField."
type: "class"
lastmod: "2026-04-23T11:19:39.121584Z"
---
## API Reference

> Source set: Common

```kotlin
@ExperimentalMaterial3ExpressiveApi
class ScrollFieldState(internal val pagerState: PagerState, val itemCount: Int)
```

A state object that can be hoisted to observe and control the scrolling behavior of a
[ScrollField](/jetpack-compose/androidx.compose.material3/material3/components/ScrollField).

In most cases, this state should be created via [rememberScrollFieldState](/jetpack-compose/androidx.compose.material3/material3/composable-functions/rememberScrollFieldState).

#### Parameters

| | |
| --- | --- |
| pagerState | the underlying [PagerState](/jetpack-compose/androidx.compose.foundation/foundation/classes/PagerState) used to handle the scroll logic. |
| itemCount | the total number of unique items available in the scroll field. |

## Properties

### selectedOption

> Source set: Common

```kotlin
val selectedOption: Int
```

The index of the currently selected option.

This value is always clamped between 0 and [itemCount](#itemcount) - 1. When the internal pager is
scrolled, this value updates to reflect the item closest to the snap position.

## Functions

### scrollToOption

```kotlin
suspend fun scrollToOption(option: Int)
```

Instantly scrolls to the specified `option`.

#### Parameters

| | |
| --- | --- |
| option | the index of the item to scroll to. |

### animateScrollToOption

```kotlin
suspend fun animateScrollToOption(option: Int)
```

Animates the scroll to the specified `option`.

#### Parameters

| | |
| --- | --- |
| option | the index of the item to animate to. |
