Skip to content

SegmentedControl

A native segmented picker with value-selection and neutral Xcode-style tab roles.

#Import

Import ui from github.com/egoist/quickgui/go/ui.

import (
	"github.com/egoist/quickgui/go/native"
	"github.com/egoist/quickgui/go/ui"
)

#Usage

func SwiftUiSegmentedControlExample() *native.Node {
	value, setValue := ui.CreateSignal("list")
	return ui.SwiftUI.Host(
		ui.SwiftUIHostProps{MatchContents: true},
		func() *native.Node {
			return ui.SwiftUI.SegmentedControl(ui.SwiftUISegmentedControlProps{
				Selection:         value,
				Options:           []ui.SwiftUIPickerOption{{Value: "list", Label: "List"}, {Value: "grid", Label: "Grid"}},
				OnSelectionChange: func(next string, _ *native.Event) { setValue(next) },
			})
		},
	)
}

#API reference

Expand an entry for its description and complete signature. A dash means no declaration default is documented.

SwiftUI.SegmentedControl

View source
ui.SwiftUI.SegmentedControl(props SwiftUISegmentedControlProps) *native.Node
TestIDany—

Stable identifier for native automation and tests.

any
View source
Modifiersany—

Ordered SwiftUI view modifiers applied to the hosted control.

any
View source
Reffunc(*native.Node)—

Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.

func(*native.Node)
View source
Selectionany—

Controlled selection for a table, native picker, or color control.

any
View source
Optionsany—

Ordered native picker options.

any
View source
Labelany—

Visible native SwiftUI control label.

any
View source
Rolestring—

Accessibility role override. Prefer the component’s built-in semantics.

string
View source
OnSelectionChangefunc(string, *native.Event)—

Reports the selected native picker option or color.

func(string, *native.Event)
View source