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.
Interactive Reference
Live showroom
Need the full visual surface?
Screenshots do not scale well across every component, state, and variant. For the real interactive reference, import the package and launch DSShowcaseRoot().
Best for exploring:
variants, states, categories, and real app examples in one place.
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
)