Skip to content

Picker

A controlled SwiftUI picker with menu, segmented, radio-group, and inline styles.

#Import

Import Picker from @quickgui/solid/swift-ui.

import { Host, Picker } from "@quickgui/solid/swift-ui";

#Usage

<Host matchContents>
  <Picker
    label="Theme"
    selection={theme()}
    options={[
      { value: "system", label: "System" },
      { value: "light", label: "Light" },
      { value: "dark", label: "Dark" },
    ]}
    style="menu"
    onSelectionChange={setTheme}
  />
</Host>

#API reference

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

Picker(props: PickerProps): NativeNode
testIDstring—

Stable identifier exposed to macOS accessibility and UI testing.

string
View source
modifiersViewModifier[]—

SwiftUI modifiers, applied in array order.

ViewModifier[]
View source
selectionstring—

Controlled selected option value.

string
View source
optionsreadonly PickerOption[]—

Declares options. Reactive JSX expressions update this property in place.

readonly PickerOption[]
View source
labelstring—

Declares label (optional). Reactive JSX expressions update this property in place.

string
View source
stylePickerStyle—

Layout, typography, paint, and interaction-state styles. Arrays merge left to right.

PickerStyle
View source
onSelectionChange(selection: string, event: QuickGuiEvent) => void—

Declares onSelectionChange (optional). Reactive JSX expressions update this property in place.

(selection: string, event: QuickGuiEvent) => void
View source
ref((node: NativeNode) => void) | NativeNode—

Declares ref (optional). Reactive JSX expressions update this property in place.

((node: NativeNode) => void) | NativeNode
View source