type Switch struct {
// contains filtered or unexported fields
}
Switch paints one two-state toggle with caller-owned state. When the
runtime provides a frame clock, a change of the checked value slides the
thumb and fades the track over the theme's Transition; the caller still
passes only the destination state.
Constructors
BeginSwitch#
func BeginSwitch(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect, checked bool) Switch
BeginSwitch starts a switch declaration. Zero-sized bounds select official
preset geometry. ID zero is a static preview and declares no hit.
Methods
Disabled#
func (switchControl Switch) Disabled() Switch
Disabled paints the official 50% opacity state and retains disabled
accessibility semantics for nonzero IDs.
Invalid#
func (switchControl Switch) Invalid() Switch
Invalid applies the official destructive validation border and ring.
Label#
func (switchControl Switch) Label(label string) Switch
Label sets the accessible name without painting text.
Paint#
func (switchControl Switch) Paint() SwitchResult
Paint draws the switch and declares its enlarged desktop hit region.
Small#
func (switchControl Switch) Small() Switch
Small selects the official compact switch size.