Docs
Components/Forms/SegmentedControl

SegmentedControl

Horizontal segment picker for switching between options.

s0 add segmented-control

Usage

@State private var view = "list"

S0.SegmentedControl(selection: $view, options: [
    (value: "list", label: "List"),
    (value: "grid", label: "Grid"),
    (value: "map", label: "Map"),
])

Parameters

NameTypeDefaultDescription
selectionBinding<Value>Binding to the currently selected value.
options[(value: Value, label: String)]Array of value-label pairs for each segment.