Button
An accessible press target that you style and compose with text or other content.
Loading interactive demo…
func ButtonExample(save func()) *ui.Element {
return ui.Button().Child("Save changes").
Height(40).
PaddingLeft(16).
PaddingRight(16).
BackgroundColor("#2563eb").
TextColor("white").
BorderRadius(8).
Hover(func(s ui.StyleBuilder) ui.StyleBuilder { return s.BackgroundColor("#3b82f6") }).
OnClick(save)
}#Import
Import ui from github.com/egoist/quickgui/go/ui.
import (
"github.com/egoist/quickgui/go/ui"
)#Usage
func ButtonExample(save func()) *ui.Element {
return ui.Button().Child("Save changes").
Height(40).
PaddingLeft(16).
PaddingRight(16).
BackgroundColor("#2563eb").
TextColor("white").
BorderRadius(8).
Hover(func(s ui.StyleBuilder) ui.StyleBuilder { return s.BackgroundColor("#3b82f6") }).
OnClick(save)
}#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
Button
View sourceui.Button() *ElementButton constructs an empty button. Add content with Child or Children.
ChildChild(child any) *Element—
Child appends content and returns this element. Content can be an element, native node, scalar, accessor, or node-returning construction callback.
Child(child any) *ElementView sourceChildrenChildren(children ...any) *Element—
Children appends multiple children in order without replacing existing content. It also accepts []any, []*Element, and []*native.Node slices as arguments. Read the retained child nodes through element.Node.Children.
Children(children ...any) *ElementView sourceStyleStyle(style StyleBuilder) *Element—
Style merges a reusable style. Scalar accessors retain independent native bindings.
Style(style StyleBuilder) *ElementView sourceOnClickOnClick(handler func()) *Element—
OnClick handles a click without an unused event parameter.
OnClick(handler func()) *ElementView sourceRefRef(handler func(*native.Node)) *Element—
Ref exposes the native handle once at this point in the declaration chain.
Ref(handler func(*native.Node)) *ElementView sourcePaddingPadding(value any) *Element—
BackgroundColorBackgroundColor(value any) *Element—
BackgroundColor sets the corresponding style property.
BackgroundColor(value any) *ElementView sourceOnKeyDownOnKeyDown(value func(*native.Event)) *Element—
OnKeyDown configures the corresponding node property.
OnKeyDown(value func(*native.Event)) *ElementView sourceOnFocusOnFocus(value func(*native.Event)) *Element—
OnFocus configures the corresponding node property.
OnFocus(value func(*native.Event)) *ElementView sourceOnBlurOnBlur(value func(*native.Event)) *Element—
OnBlur configures the corresponding node property.
OnBlur(value func(*native.Event)) *ElementView sourceDisabledDisabled(value any) *Element—
AriaLabelAriaLabel(value any) *Element—
FocusOnPointerFocusOnPointer(value any) *Element—
FocusOnPointer configures the corresponding node property.
FocusOnPointer(value any) *ElementView sourceFocusableWhenDisabledFocusableWhenDisabled(value any) *Element—
FocusableWhenDisabled configures the corresponding node property.
FocusableWhenDisabled(value any) *ElementView source