Compose Modifier

verticalScroll

Modify element to allow to scroll vertically when height of the content is bigger than max constraints allow.

VerticalScrollExample

@Sampled
@Composable
fun VerticalScrollExample() {
    val scrollState = rememberScrollState()
    val gradient =
        Brush.verticalGradient(
            listOf(Color.Red, Color.Blue, Color.Green),
            0.0f,
            10000.0f,
            TileMode.Repeated,
        )
    Box(
        Modifier.verticalScroll(scrollState)
            .fillMaxWidth()
            .requiredHeight(10000.dp)
            .background(brush = gradient)
    )
}
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: