selection/DSToggle
DSToggle
selectionOn/off switch with an optional label and description. Wraps the native SwiftUI Toggle with design-token styling.
iOS 17+macOS 14+watchOS 10+
Purpose
Binary settings and preferences. Use in settings screens and forms.
States
on
Tinted with DSColor.primary.
off
Neutral grey tint.
disabled
50% opacity, no interaction.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| labelreq | String | — | Toggle label. |
| description | String? | nil | Optional sub-label. |
| isOnreq | Binding<Bool> | — | Binding to toggle state. |
| isDisabled | Bool | false | Disables the toggle. |
Examples
Settings row
Toggle in a settings list.
swift
DSToggle(
"Push notifications",
description: "Receive alerts when tasks are assigned.",
isOn: $settings.pushNotifications
)