functions

Grid
Edited: Sunday 25 January 2026

Grid

Category: Layouts
File: layouts.go
Package: ui

Signature

1func Grid(l *List, count int, minItemSize int, ele layout.ListElement) W

Description

Grid creates a responsive grid layout that adapts to available width.
Items are arranged in rows with consistent sizing based on minItemSize.

Example:

list := NewVerticalList()
grid := Grid(list, 20, 100, func(c C, i int) D {
    return Label(fmt.Sprintf("Item %d", i))(c)
})

The grid calculates columns automatically: perRow = width / minItemSize

Examples

Grid

1{
2	list := NewVerticalList()
3	grid := Grid(&list, 20, 100, func(c C, i int) D {
4		return Label("Item")(c)
5	})
6	_ = grid
7}

Example Output


This documentation is auto-generated. To update, run make docs

Backlinks