lotusui
A Go design system for desktop and mobile — one codebase, native apps. Web when you want it.
GitHub

Toggle

The pressed-state button, and groups with single or multiple selection.

Toggle stays filled while On; clicking flips it. ToggleGroup coordinates a row — radio semantics by default (Sel), independent bools with Multiple.

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 toggle

Usage

open demo ↗

ToggleGroup — single

open demo ↗

ToggleGroup — multiple

open demo ↗

Sizes

open demo ↗

Disabled

open demo ↗

Group outline

open demo ↗

Group sizes

The size is the Layout parameter — the whole group moves together.

open demo ↗

Group disabled

open demo ↗

Group vertical

open demo ↗

Group spacing

Spacing overrides the 2dp gap between items.

open demo ↗

Font weight selector

Content replaces Icon/Label with arbitrary content inside the item's chrome — composed here with a Field.

open demo ↗

API

OptionTypeDescription
OnboolThe pressed state — yours; clicking flips it.
Icon / LabelstringOne or both.
Contentlayout.WidgetReplaces Icon/Label with arbitrary content in the chrome.
SizeSizeThe shared size presets.
OutlineboolBordered while off.
DisabledboolDimmed, unclickable.
ToggleGroup.Options[]ToggleOptionThe choices: Label, Value, Icon, Content. ToggleOpts("a","b") builds label-only lists (the longer name: ToggleProps is this component's per-call options struct).
ToggleGroup.Value() / SetValue(v)stringSingle-select choice; unknown values clear.
ToggleGroup.Values() / SetValues(vs)[]stringMulti-select choices, in Options order; unknown values ignored.
ToggleGroup.MultipleboolIndependent choices instead of radio semantics.
ToggleGroup.Outline / DisabledboolGroup-wide chrome and state.
ToggleGroup.Vertical / Spacingbool / unit.DpStacked axis; gap override (default 2dp).

lotusui is a Go design system for native desktop and mobile — and the web when you want it. Docs demos are the real components (WebAssembly) — one gallery app, each Preview an iframe addressed by URL hash.