Skip to content

Radio Group ​

Single-select runtime: Group owns value, Item represents options, Indicator renders the selected mark.

Runtime ​

State contracts come from @varo-ui/headless; rendered parts come from @varo-ui/h5/primitives or @varo-ui/weapp/primitives.

Demo ​

Package@varo-ui/headless

Basic usage ​

Use the Demo panel above to switch H5 and Weapp primitive preview/code; each runtime renders only the current entry.

Disabled item ​

Set disabled on RadioItem to keep the group value contract while blocking one option.

Parts ​

PartPurpose
RadioGroupGroup value and context
RadioItemOne option
RadioIndicatorSelected indicator

Props ​

RadioGroup ​

PropTypeDefaultDescription
valuestring | number | undefinedundefinedControlled selected value
defaultValuestring | numberundefinedUncontrolled initial value
disabledbooleanfalseDisables the whole group
asstring'div'Root element tag

RadioItem ​

PropTypeDefaultDescription
valuestring | numberrequiredOption value
disabledbooleanfalseDisables one option
asstring'button'Option element tag

Events ​

EventPayloadDescription
update:valuestring | numberSync controlled value
valueChangestring | numberFires when value changes

Accessibility ​

  • Group value determines the selected item.
  • Disabled items cannot be selected.
  • Indicator reflects state only.

Platform notes

  • H5 and mini-program share the value/disabled contract.
  • Mini-program keyboard focus stays page-owned. :::