androidx.compose.material3

ScrollFieldSince 1.12Experimental

Composable function

One of the helpers on this page. It works like ProvideTextStyle. Only the parameters that differ are described here.

A wheel of numbers. The user scrolls to pick one, like the minutes in a time picker.

A scroll field to pick a minuteExpressive theme
A scroll field to pick a minute
val state = rememberScrollFieldState(itemCount = 60, index = 15)
ScrollField(state = state, modifier = Modifier.size(96.dp, 160.dp))

ParametersExperimental

@Composable
fun ScrollField(
    state: ScrollFieldState,
    modifier: Modifier = Modifier,
    colors: ScrollFieldColors = ScrollFieldDefaults.colors(),
    field: @Composable (index: Int, selected: Boolean) -> Unit = { index, selected -> ScrollFieldDefaults.Item(index = index, selected = selected, colors = colors) },
)

state: ScrollFieldStateRequired

The selected number of a scroll field and its range.

modifier: ModifierOptional

Default: Modifier

Changes size, padding, or position. See the Modifier guide.

colors: ScrollFieldColorsOptional

Default: ScrollFieldDefaults.colors()

The colors of the drag handle or scroll field.

field: @Composable (index: Int, selected: Boolean) -> UnitOptional

Default: { index, selected -> ScrollFieldDefaults.Item(index = index, selected = selected, colors = colors) }

Draws one number in the scroll field.

Helpers on this page