Skip to content
Lists & Grids

Lazy Grid

Two-dimensional grid with a fixed column count

LazyVerticalGrid arranges items into columns described by GridCells. A GridCells.Fixed value pins the column count, while aspectRatio keeps each cell square.

Lazy Grid demos rendered in Compose Playground
Pixel-accurate preview · light theme

Examples

01

Fixed three-column grid

A fixed-height grid of square, colored cells.

Kotlin
LazyVerticalGrid(
    columns = GridCells.Fixed(3),
    horizontalArrangement = Arrangement.spacedBy(8.dp),
    verticalArrangement = Arrangement.spacedBy(8.dp),
    modifier = Modifier.height(220.dp)
) {
    items(cells) { color ->
        Box(
            modifier = Modifier
                .aspectRatio(1f)
                .clip(RoundedCornerShape(8.dp))
                .background(color)
        )
    }
}