Skip to content

ORadio ​

ORadio renders one native radio option in a controlled group.

Usage ​

Step by step ​

  1. Import ORadio from the ooko-ui/radio public subpath.
  2. Bind one value with v-model and use the same name for every option in the group.
  3. Give each option a distinct value and its own visible label.

Example ​

The rendered example and its source come from the same Vue single-file component.

Interactive playground ​

Change the selected value, label, guidance, size, and radio states. The preview updates immediately.

Cancel any time.

Props ​

PropTypeDefaultDescription
modelValueValueundefinedCurrent selected value for the native radio group.
valueValueundefinedValue represented by this radio.
sizeOokoFormControlSizeundefinedControls the choice control's form-control scale.
labelstringundefinedVisible or visually hidden accessible label.
idstringundefinedNative input identifier. A hydration-safe identifier is generated when omitted.
namestringundefinedNative form field name and OForm validation key.
hintstringundefinedPersistent guidance displayed below the choice control.
errorstringundefinedControlled validation error displayed below the choice control.
validationOokoValidationBindingundefinedValidation binding created by useOokoValidation.
hideLabelbooleanfalseVisually hides the label while preserving its accessible name.
requiredbooleanfalseMarks the native input as required.
disabledbooleanfalseDisables the native input.
readonlybooleanfalsePrevents changes while keeping the input focusable.

Events ​

EventPayloadDescription
update:modelValueValueEmits this radio's value after a native selection change.

Slots ​

SlotPropsDescription
defaultnoneProvides the radio label content.
TypeDefinition
ORadioValuetype ORadioValue = number | string;
OokoFormControlSizetype OokoFormControlSize = "sm" | "md";

CSS custom properties ​

Custom propertyDefaultDescription
--o-radio-gapvar(--o-space-2)Sets the space between the radio indicator and its label.
--o-radio-indicator-sizevar(--o-space-5)Sets the radio indicator size.
--o-radio-focus-width0.1875remSets the focus outline width.
--o-radio-focus-stylesolidSets the focus outline style.
--o-radio-focus-offset0.125remSets the distance between the indicator and focus outline.
--o-radio-disabled-opacity0.5Sets the opacity of a disabled radio.

Override example ​

css
:root {
  --o-radio-indicator-size: var(--o-space-6);
}

Accessibility ​

Each option uses a native radio and a control row that acts as its label, so clicking its indicator or text selects it. For radios sharing a name, Tab enters the group once and the arrow keys move the selection between options, matching browser and assistive-technology conventions. Focus is visible, and disabled behavior uses the native attribute. readonly remains focusable and exposes aria-readonly while preventing selection changes. Hints and errors are connected to the input, with polite error announcements. Forced-colors and reduced-motion preferences are respected.

Behavior and edge cases ​

Every radio requires a value; it emits that value after selection. Use one v-model and the same name for all options in a group. Native attributes and listeners are forwarded to the input; consumer classes and styles apply to the component root. size accepts sm and md, and may be configured through app defaults.