Files
CrychicUI/layout/cluster.go
T
ZacharyZhang-NYandClaude Opus 5.5 4efaf2680f Add layout components 0001-0025
Stack through StickyHeader, with behavior tests and gallery demos.
kit gains Arrive, Settle (paint-time layout check) and Shade.
Several actions return named ui.Element results; mygo vet forbids
elements in structs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-17 02:49:32 -04:00

16 lines
536 B
Go

package layout
import "github.com/egoist/mygo/ui"
// Cluster wraps items aligned Start, Center or End; items glide.
func Cluster(c *ui.Context, align ui.Align, items []func()) ui.Element {
if align != ui.Start && align != ui.Center && align != ui.End {
panic("layout: Cluster align must be Start, Center or End")
}
return ui.Row(c).FillWidth().Wrap().Justify(align).Gap(c.Theme().Space(2)).Children(func() {
for i, it := range items {
ui.Box(c).Key(i).Transition(ui.ElementTransition{Position: true}).Children(it)
}
})
}