Skip to content

Toggle

A controlled native SwiftUI on/off switch.

#Import

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

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

#Usage

<Host matchContents>
  <Toggle
    label="Notifications"
    isOn={notifications()}
    onIsOnChange={setNotifications}
  />
</Host>

#API reference

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

Toggle(props: ToggleProps): NativeNode
testIDstring—

Stable identifier exposed to macOS accessibility and UI testing.

string
View source
modifiersViewModifier[]—

SwiftUI modifiers, applied in array order.

ViewModifier[]
View source
isOnboolean—

Controlled SwiftUI `isOn` value.

boolean
View source
labelstring—

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

string
View source
onIsOnChange(isOn: boolean, event: QuickGuiEvent) => void—

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

(isOn: boolean, 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