Fields

Radio

Radio is the single-select choice field for a group of options.

Use this page to preserve the required attributes and option markup used by the checkbox-radio module.

Preview

Attributes

Radio fields span a field wrapper, an options container, and one or more visible radio inputs.

Field

AttributePurposeImportance
data-formie-field-handleStable field identity used by validation, conditions, and error renderingRequired

Field layout

AttributePurposeImportance
data-formie-radio-field-layoutGroup selector used by the checkbox-radio moduleRequired for radio behavior

Field options

AttributePurposeImportance
data-formie-radio-optionsOption-group wrapperRequired for radio behavior

Field input

AttributePurposeImportance
data-formie-radio-inputRadio selector used by FormieRequired for radio behavior
Shared name across optionsEnsures one logical radio groupRequired
data-formie-input-id per optionStable option identityRecommended

Styling classes

These classes are for presentation only. They are not behavior requirements:

Field layout

ClassDescription
formie-radio-field-layoutRadio group layout styling class
formie-radio-field-labelRadio group label styling class

Field options

ClassDescription
formie-field-optionsShared option-group styling
formie-radio-optionsRadio group options styling class
formie-field-optionShared option wrapper styling
formie-radio-optionRadio option wrapper styling class

Field input

ClassDescription
formie-inputShared radio styling and focus treatment
formie-radio-inputRadio input styling class
formie-input-errorError-state styling class

Field option label

ClassDescription
formie-field-option-labelShared option label styling
formie-radio-option-labelRadio option label styling class

Behavior

The checkbox-radio module:

  • synchronizes checked attributes after user interaction
  • keeps radio groups consistent when the selected option changes

Events

Radio fields use the shared checkbox-radio field events described on JavaScript events.

The formie:field:checkbox-radio:init event

Triggered after the radio group has been wired and is ready for interaction.

js
document.addEventListener('formie:field:checkbox-radio:init', (event) => {
  const { checkboxRadio } = event.detail;

  // Only target the contact preference field.
  if (checkboxRadio?.dataset.formieFieldHandle !== 'contactPreference') {
    return;
  }

  // Run custom setup once the group is ready.
  console.log('Radio group ready:', checkboxRadio);
});
Last updated: May 6, 2026, 3:46 PM