selection/DSRadioGroup

DSRadioGroup

selection
since v1.0

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

iOS 17+macOS 14+

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, icon: String?)]Available options.
selectedreqBinding<String>Binding to the selected value.
labelString?nilGroup label.

Examples

Plan selector

Select a subscription plan.

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

Related Components