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 radio

Props

PropTypeDefaultDescription
valueOption<String>NoneControlled selected value
default_valueOption<String>NoneInitial value for uncontrolled usage
disabledboolfalseDisables the entire group
orientationOrientationVerticalLayout direction: Vertical, Horizontal
on_changeOption<Callback<String>>NoneFires when selection changes

Accessibility

  • Group renders with role="radiogroup", items with role="radio".
  • Arrow keys navigate between options. Space selects the focused option.
  • Only the selected item is in the tab order.

Source

Primitive: radio.rs
Styled: radio.rs