RadioGroup
The exclusive choice: labeled circles, exactly one selected.
State lives on the struct (Selected); clicks are processed at the
top of Layout. Per-option disabling is index-aligned, like Tabs.
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 radio-group
Usage
var density = lotusui.RadioGroup{Selected: 0}
density.Layout(th, gtx, "Default", "Comfortable", "Compact")
chosen := density.Selected
Disabled option
plans := lotusui.RadioGroup{Disabled: []bool{false, true, false}}
Description
Descriptions, index-aligned, render muted under each label.
density := lotusui.RadioGroup{Descriptions: []string{
"Standard spacing for most use cases.",
"More space between elements.",
"Dense layout for scanning lots of data.",
}}
Invalid
Invalid renders danger rings; pair it with a Field error.
prefs := lotusui.RadioGroup{Invalid: true}
API
| Option | Type | Description |
|---|---|---|
Selected | int | The chosen option — yours. |
Size | Size | The shared size presets scale the circles. |
Disabled | []bool | Per-option, index-aligned. |
Invalid | bool | Danger chrome on the circles. |