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.

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

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