Radio
Mutually exclusive selection within a group. Only one option can be selected at a time.
Primitive: RadioGroupARIA: role="radiogroup" + role="radio"Keyboard: Arrow keys, Space
Default
Comfortable
Compact
radio.rs
use stratum_leptos::*;
view! {
<RadioGroup default_value="default">
<Radio value="default">"Default"</Radio>
<Radio value="comfortable">"Comfortable"</Radio>
<Radio value="compact">"Compact"</Radio>
</RadioGroup>
}Installation
stratum add radioProps
| Prop | Type | Default | Description |
|---|---|---|---|
| value | Option<String> | None | Controlled selected value |
| default_value | Option<String> | None | Initial value for uncontrolled usage |
| disabled | bool | false | Disables the entire group |
| orientation | Orientation | Vertical | Layout direction: Vertical, Horizontal |
| on_change | Option<Callback<String>> | None | Fires when selection changes |
Accessibility
- Group renders with
role="radiogroup", items withrole="radio". - Arrow keys navigate between options.
Spaceselects the focused option. - Only the selected item is in the tab order.