BeginButton#
func BeginButton(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect) ButtonBeginButton starts a button declaration. Hit ID zero paints a static preview without adding an interaction region.
type Button struct {
// contains filtered or unexported fields
}Button is one allocation-free in-flight button declaration.
BeginButton#func BeginButton(canvas *ui.Canvas, theme ui.Theme, id ui.ID, bounds ui.Rect) ButtonBeginButton starts a button declaration. Hit ID zero paints a static preview without adding an interaction region.
BoundsHeight#func (button Button) BoundsHeight() float32BoundsHeight exposes the height the selected size paints at.
BoundsWidth#func (button Button) BoundsWidth() float32BoundsWidth exposes the fitted width for callers laying out neighbors.
CenterIn#func (button Button) CenterIn(area ui.Rect) ButtonCenterIn centers the button's current bounds within area. Call it after SizeToFit when an empty state or dialog action needs a centered control.
Default#func (button Button) Default(label string) ButtonResultDefault paints the primary official default variant.
Destructive#func (button Button) Destructive(label string) ButtonResultDestructive paints the official destructive variant.
DestructiveOutline#func (button Button) DestructiveOutline(label string) ButtonResultDestructiveOutline paints the bordered, danger-labelled variant.
Disabled#func (button Button) Disabled() ButtonDisabled paints the official 50% opacity state and exposes disabled typed semantics when the declaration has a nonzero ID.
Ghost#func (button Button) Ghost(label string) ButtonResultGhost paints the official borderless variant.
Icon#func (button Button) Icon() ButtonIcon selects the square default icon size.
IconLarge#func (button Button) IconLarge() ButtonIconLarge selects the square 40px icon size at default density.
IconSmall#func (button Button) IconSmall() ButtonIconSmall selects the square 32px icon size at default density.
IconXSmall#func (button Button) IconXSmall() ButtonIconXSmall selects the square 24px icon size at default density.
Invalid#func (button Button) Invalid() ButtonInvalid applies the official destructive validation ring.
Large#func (button Button) Large() ButtonLarge selects the 40px size at default density.
Link#func (button Button) Link(label string) ButtonResultLink paints the official link-colored button variant.
Outline#func (button Button) Outline(label string) ButtonResultOutline paints the official bordered variant.
Secondary#func (button Button) Secondary(label string) ButtonResultSecondary paints the official secondary variant.
Size#func (button Button) Size(size ButtonSize) ButtonSize selects an official size variant.
SizeToFit#func (button Button) SizeToFit(label string) ButtonSizeToFit widens the button to its label plus the selected size padding.
Small#func (button Button) Small() ButtonSmall selects the 32px size at default density.
WithState#func (button Button) WithState(state ButtonState) ButtonWithState pins a visual state, overriding canvas-derived interaction state.
XSmall#func (button Button) XSmall() ButtonXSmall selects the 24px compact size at default density.