Button
A native SwiftUI button with text, SF Symbol, semantic role, and press handling.
#Import
Import ui from github.com/egoist/quickgui/go/ui.
import (
"fmt"
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#Usage
func SwiftUiButtonExample() *native.Node {
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.Button(ui.SwiftUIButtonProps{
Label: "Save",
SystemImage: "checkmark",
OnPress: func(*native.Event) { fmt.Println("Saved") },
Modifiers: []ui.SwiftUIModifier{ui.SwiftUI.ButtonStyle("borderedProminent")},
})
},
)
}#API reference
Expand an entry for its description and complete signature. A dash means no declaration default is documented.
SwiftUI.Button
View sourceui.SwiftUI.Button(props SwiftUIButtonProps, children ...any) *native.NodeTestIDany—
Modifiersany—
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)View sourceLabelany—
SystemImagestring—
Rolestring—
OnPressfunc(*native.Event)—
Targetstring—
ChildrenComponent—
Content mounted inside the component. Compound child callbacks run after the parent context exists.
ComponentView source