Stack
VStack and HStack: children size themselves, the gap is the whole job.
A lotusui extension: the stacking primitives that stop screens hand-weaving spacer
children between rows. VStack stacks vertically, HStack horizontally
with children centered on the cross axis.
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 get github.com/ikaito-com/lotusui
# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add stack
VStack
lotusui.VStack(th.Space.SM, first, second, third)
HStack
Children center on the cross axis, so a switch and its label sit on one visual line.
lotusui.HStack(th.Space.SM, one, two, three)
Hairlines and spacers
Hairline draws the 1dp divider spanning the available width — use it
only inside a vertical flex; between horizontal siblings use VerticalHairline.
Spacer/HSpacer are fixed gaps for ad-hoc composition.
lotusui.Hairline(th) // inside a vertical stack
lotusui.VerticalHairline(th) // between horizontal siblings
API
| Option | Type | Description |
|---|---|---|
VStack(gap, children...) | unit.Dp | Vertical stack; the gap is the whole job. |
HStack(gap, children...) | unit.Dp | Horizontal stack, children centered on the cross axis. |
Spacer(h) / HSpacer(w) | unit.Dp | Fixed gaps for ad-hoc composition. |
Hairline(th) / VerticalHairline(th) | widget | 1dp rules; vertical for row siblings. |