androidx.compose.material3

ScrollFieldStateSince 1.12Experimental

Class

No hand-written docs yet.

A state object that can be hoisted to observe and control the scrolling behavior of a ScrollField.

class ScrollFieldState(
    pagerState: PagerState,
    itemCount: Int,
)

How to get one

Create it

Ready-made values and functions that return it

Used by

Parameters that take a ScrollFieldState.

Properties

selectedOption

val selectedOption: Int

The index of the currently selected option.

itemCount

val itemCount: Int

Functions

scrollToOption

fun scrollToOption(option: Int)

Instantly scrolls to the specified option.

animateScrollToOption

fun animateScrollToOption(option: Int)

Animates the scroll to the specified option.

Library docs

A state object that can be hoisted to observe and control the scrolling behavior of a ScrollField.

In most cases, this state should be created via rememberScrollFieldState.