Documentation
¶
Index ¶
- type Button
- func (b *Button) Click()
- func (b *Button) Icon(icon elements.Element) *Button
- func (b *Button) Label(label string) *Button
- func (b *Button) Layout(gtx layout.Context) layout.Dimensions
- func (b *Button) OnClick(fn func()) *Button
- func (b *Button) Styles(st styles.Styles) *Button
- func (b *Button) Variant(v Variant) *Button
- type Variant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct {
// Contextual gives it a context menu (Context).
elements.Contextual
// contains filtered or unexported fields
}
Button is a stateful clickable icon-only button. Create it once with New and lay it out every frame; the icon, styles and handler may change at any time.
func New ¶
New returns a Button laying out icon. The styles argument is optional: Background is the fill, Color the hover/press tint of the transparent variants. The icon carries its own color and size.
func (*Button) Label ¶
Label sets the accessible name reported to automation (the semantic tree, the MCP server), since the button shows no text. It returns b for chaining.
func (*Button) Layout ¶
func (b *Button) Layout(gtx layout.Context) layout.Dimensions
Layout lays out and updates the button.
func (*Button) OnClick ¶
OnClick sets the handler invoked on every click. It returns b for chaining.
type Variant ¶
type Variant string
Variant selects the button's visual style.
const ( // VariantContained fills the button with Background (or black if // unset) at all times - the default. VariantContained Variant = "contained" // VariantOutlined is transparent with a visible border, filling // faintly with the border color on hover/press. VariantOutlined Variant = "outlined" // VariantGhost is fully transparent at rest - only the icon is // visible - filling faintly with Color on hover/press. VariantGhost Variant = "ghost" )