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

Other option

When the Other option is enabled, Formie renders a dedicated option row with its own theme config tags.

Theme config tagPurpose
fieldOtherOptionWrapper for the entire Other choice row
fieldOtherOptionInputThe Other radio input
fieldOtherOptionLabelThe Other option label
fieldOtherOptionTextThe custom text input shown when Other is selected
AttributePurposeImportance
data-formie-other-option-rowOther option row wrapperRecommended
data-formie-other-optionOther radio input markerRequired for Other behaviour
data-formie-other-option-textOther text input markerRequired for Other behaviour
data-formie-other-option-labelOther option label markerRecommended
ClassDescription
formie-other-optionOther option row styling class
formie-other-option-inputOther radio input styling class
formie-other-option-labelOther option label styling class
formie-other-option-textOther text input 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: Jun 24, 2026, 10:00 PM