lotusui the ikaito design language for Gio — desktop, mobile, web
GitHub

SimpleGrid

Responsive equal cells: give a minimum child width, get the right column count.

A lotusui extension. SimpleGrid derives its column count from the available width (never below 1, never above maxCols) — resize the window and the columns follow, no breakpoints to declare. Every cell in a row gets the tallest cell's height via a measure pass, and a trailing partial row is padded so cells don't stretch. Reach for Grid when you need explicit tracks and spans.

Installation

Use the module import (the default), or own the source: lotusui add vendors the component into your app and lotusui update keeps the copy mergeable — see Registry.

Go
go get github.com/ikaito-com/lotusui

# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add grid

Usage — responsive columns

Columns derive from available width / minChildWidth. This demo box tracks the page width — narrow the window and the grid reflows.

Go
lotusui.SimpleGrid(gtx, items, 140, 4, th.Space.SM,
	func(gtx C, it Item) D { return cell(it)(gtx) })

Equal-height rows

A measure pass finds the tallest cell per row; every sibling gets that height as its minimum — cards in a row stay flush.

Go
// Card honors Constraints.Min.Y for exactly this.
lotusui.SimpleGrid(gtx, entries, 140, 3, th.Space.SM, cell)

API

OptionTypeDescription
items[]TOne cell per item, any type.
minChildWidthunit.DpColumn count derives from available width / this.
maxColsintUpper bound on columns.
gapunit.DpSpacing between cells, both axes.
cellfunc(C, T) DRenders one item — a tile, a Card, anything.

Every demo on this site is the real Go component compiled to WebAssembly — one gallery app, one bundle, addressed by URL hash.