-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Add radio buttons with a declarative, controlled group API. <RadioGroup value={expr} onChange={|v| ...}> wraps multiple <Radio value="...">Label</Radio> items. Selection is mutually exclusive and updates the bound value.
- Standard UX for choosing one of several options.
- Cleaner than wiring multiple
RadioButtoncalls manually. - Integrates with forms and settings screens.
Scope
- New tags:
<RadioGroup>and<Radio>. - Controlled group:
value={expr},onChange={|v| ...}. - Optional attributes:
horizontal=bool,enabled,tooltip. <Radio>attributes:value=...; children as label text/inline content.
Proposed API (sketch)
efx!(ui, r#"
<RadioGroup value={prefs.layout} onChange={|v| prefs.layout = v} horizontal="true">
<Radio value="List">List</Radio>
<Radio value="Grid">Grid</Radio>
<Radio value="Compact">Compact</Radio>
</RadioGroup>
"#);
// Mapping (conceptual):
// For each <Radio>: ui.radio_value(&mut group_value, radio_value, label);Tasks
- AST for
<RadioGroup>/<Radio>and validation (no stray<Radio>outside a group). - Codegen: use
ui.radio_value(&mut value, item_value, label); emitonChangewhen value changes. - Layout:
horizontal=truearranges items in a row; otherwise column. - Attributes:
enabled,tooltipon group and/or items. - Diagnostics: duplicate values; missing
valueon group or item; nested groups. - Examples: layout preference selector; enum-backed group.
- trybuild UI tests for invalid structures and conflicts.
- Ensure examples build for
wasm32-unknown-unknown.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request