selection/DSRadioGroup
DSRadioGroup
selectionSingle-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
| Prop | Type | Default | Description |
|---|---|---|---|
| optionsreq | [(label: String, value: T, icon: String?)] | — | Available options. |
| selectedreq | Binding<String> | — | Binding to the selected value. |
| label | String? | nil | Group 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
)