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.
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
)