androidx.compose.foundation.lazy.grid

LazyHorizontalGrid

Composable function · from org.jetbrains.compose.foundation:foundation:1.12.2

One of the grid types. It works like LazyVerticalGrid. Only the parameters that differ are described here.

A grid with a fixed number of rows that scrolls sideways. Set the rows with rows = GridCells.Fixed(2), and give the grid a height.

Parameters

@Composable
fun LazyHorizontalGrid(
    rows: GridCells,
    modifier: Modifier = Modifier,
    state: LazyGridState = rememberLazyGridState(),
    contentPadding: PaddingValues = PaddingValues(0.dp),
    reverseLayout: Boolean = false,
    horizontalArrangement: Arrangement.Horizontal = if (!reverseLayout) Arrangement.Start else Arrangement.End,
    verticalArrangement: Arrangement.Vertical = Arrangement.Top,
    flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
    userScrollEnabled: Boolean = true,
    overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
    content: LazyGridScope.() -> Unit,
)

rows: GridCellsRequired

How many rows, and how high, for a horizontal grid.

Defaults that differ from LazyVerticalGrid:

Same as in LazyVerticalGrid: modifier, state, contentPadding, reverseLayout, horizontalArrangement, verticalArrangement, flingBehavior, userScrollEnabled, overscrollEffect, content.

Grid types