selection/DSToggle

DSToggle

selection
since v1.0

On/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

PropTypeDefaultDescription
labelreqStringToggle label.
descriptionString?nilOptional sub-label.
isOnreqBinding<Bool>Binding to toggle state.
isDisabledBoolfalseDisables the toggle.

Examples

Settings row

Toggle in a settings list.

swift
DSToggle(
    "Push notifications",
    description: "Receive alerts when tasks are assigned.",
    isOn: $settings.pushNotifications
)

Related Components