Skip to content

Radio ​

A radio button. Radios sharing a group name behave as a mutually exclusive set, and the group supports WAI-ARIA arrow-key navigation.

a-sxr-radio Component ​

Properties ​

PropertyDescriptionDefault Value
onEvent that triggers onclick actionclick
checkedWhether the radio is initially selectedfalse
activeWhether the radio is enabledtrue
groupGroup name; selecting one radio unchecks same-group radios''
valueText of the radio button label''
font-familyFont family for radio buttonOutfit-Regular.ttf
font-sizeFont size for radio button0.2
font-colorText color for radio button label#161618
border-colorBorder color of radio button#1B1B1F
background-colorBackground color of radio button#F1F5F9
hover-colorBackground color when radio button is in hover state#0EA5E9
handle-colorColor of the radio center handle#202127
active-colorBackground color when radio button is pressed down#2563EB
radiosizecoefScale factor for the radio circle size1
keyTextual shortcut key that activates the widget (e.g. 'e')
key-codeLegacy numeric shortcut key (e.g. 32 for Space)-1
widthWidth of radio button1
heightHeight of radio button1
marginMargin around radio button0 0 0 0
html
<a-sxr-radio
	width="2.5" height="0.75"
	onclick="toggleActionFunction"
	value="radio label"
	font-size="0.3"
	margin="0 0 0.05 0"
>
</a-sxr-radio>

Groups ​

Give radios the same group value to make them mutually exclusive — selecting one automatically unchecks its siblings.

html
<a-sxr-flex-container flex-direction="column" item-padding="0.1" opacity="1"
                      width="3" height="2" position="0 1.6 -2">
  <a-sxr-radio group="quality" checked="true" value="Low"></a-sxr-radio>
  <a-sxr-radio group="quality" value="Medium"></a-sxr-radio>
  <a-sxr-radio group="quality" value="High"></a-sxr-radio>
</a-sxr-flex-container>

Keyboard ​

KeyAction
SpaceSelect the focused radio
↑ ↓Move selection through the group
← →Move selection through the group

aria-checked reflects the selected state, and selection is animated. active="false" disables the radio.