selection/DSRadioGroup

DSRadioGroup

selection
since 0.1.0

Single-select radio button group. Generic over any Hashable value type.

iOS 17+macOS 14+watchOS 10+tvOS 17+visionOS 1+

Purpose

Mutually exclusive options in forms and settings. Use when all options should be visible at once.

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.

Props

PropTypeDefaultDescription
optionsreq[(label: String, value: T)]—Available options. T is any Hashable value.
selectionreqBinding<T>—Binding to the selected value.
isDisabledBoolfalseDisables the whole group.
colorColor?nilSelected indicator color.

Examples

Plan selector

Select a billing period.

swift
DSRadioGroup(
    options: [
        (label: "Monthly", value: "monthly"),
        (label: "Annual — save 20%", value: "annual"),
    ],
    selection: $billingPeriod
)

Related Components