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

ButtonGroup

Attached controls: one shared border, square inner corners.

Children sit edge-to-edge — neighbors overlap by 1dp so their borders collapse to a single line, inner corners render square, and only the group's outer corners keep the radius. Slots hold buttons, a separator seam, or any widget (an input) with flex weight.

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 button-group

Usage

Go
lotusui.ButtonGroup(th, lotusui.ButtonGroupOpts{},
	lotusui.ButtonGroupItem{Btn: &archive, Label: "Archive", Opts: lotusui.ButtonOpts{Variant: lotusui.ButtonOutline}},
	lotusui.ButtonGroupItem{Btn: &report, Label: "Report", Opts: lotusui.ButtonOpts{Variant: lotusui.ButtonOutline}},
	lotusui.ButtonGroupItem{Btn: &snooze, Label: "Snooze", Opts: lotusui.ButtonOpts{Variant: lotusui.ButtonOutline}},
)

Orientation

Vertical stacks the group top-to-bottom.

Go
lotusui.ButtonGroup(th, lotusui.ButtonGroupOpts{Vertical: true}, plus, minus)

Sizes

Size the items — the group follows.

Go
lotusui.ButtonGroupItem{Btn: &b, Label: "Small",
	Opts: lotusui.ButtonOpts{Variant: lotusui.ButtonOutline, Size: lotusui.SizeSM}}

Separator

ButtonGroupSeparator() renders the hairline seam between attached neighbors.

Go
lotusui.ButtonGroup(th, lotusui.ButtonGroupOpts{},
	copyItem, lotusui.ButtonGroupSeparator(), pasteItem)

Split

The split button: a main action and an attached icon action across a seam.

Go
lotusui.ButtonGroup(th, lotusui.ButtonGroupOpts{},
	mainItem, lotusui.ButtonGroupSeparator(), iconItem)

With input

A flexed Widget slot carries any control — the search-and-go row.

Go
lotusui.ButtonGroup(th, lotusui.ButtonGroupOpts{},
	lotusui.ButtonGroupItem{Flex: 1, Widget: searchInput},
	lotusui.ButtonGroupItem{Btn: &go_, Opts: lotusui.ButtonOpts{Variant: lotusui.ButtonOutline, IconStart: lotusui.IconSearch}},
)

API

OptionTypeDescription
ButtonGroupOpts.VerticalboolStack the group top-to-bottom.
ButtonGroupItem.Btn / Label / OptsA button slot; the group sets Opts.Attached.
ButtonGroupItem.SeparatorboolThe hairline seam (ButtonGroupSeparator()).
ButtonGroupItem.Widget / Flexlayout.Widget / float32Arbitrary content; flexed weight.
ButtonOpts.AttachedAttachedEdgesSquares the corners on attached sides — set by the group.

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