Fields

Agree ​

Agree is the consent checkbox field used for terms, privacy, and one-line confirmations.

Use this page to preserve the hidden input, checkbox attributes, and consent label structure when you customise the field.

Preview ​

Attributes ​

Agree fields span a field wrapper, an optional hidden fallback input, and the visible consent checkbox.

Field ​

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

Hidden Input ​

AttributePurposeImportance
data-formie-input-type="agree"Empty-state submission fallbackRecommended

Field Layout ​

AttributePurposeImportance
data-formie-agree-field-layoutLayout marker used by the checkbox-radio moduleRequired for agree behaviour

Field Input ​

AttributePurposeImportance
data-formie-agree-inputConsent checkbox selectorRequired for agree behaviour
data-formie-input-type="agree"Consent-specific input type marker in the rendered markupRecommended

Field Option Label ​

AttributePurposeImportance
data-formie-agree-option-labelConsent text label attributeRecommended

Styling Classes ​

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

Field ​

ClassDescription
formie-agree-fieldAgree field wrapper styling class

Field Layout ​

ClassDescription
formie-agree-field-layoutAgree field layout styling class
formie-agree-field-labelAgree field label styling class

Field Options ​

ClassDescription
formie-agree-optionsAgree option group styling class
formie-agree-optionAgree option wrapper styling class

Field Input ​

ClassDescription
formie-inputShared checkbox styling and focus treatment
formie-checkbox-inputShared checkbox input styling class
formie-agree-inputAgree-specific checkbox styling class
formie-input-errorError-state styling class

Field Option Label ​

ClassDescription
formie-field-option-labelShared option label styling
formie-checkbox-option-labelShared checkbox option label styling
formie-agree-option-labelAgree-specific option label styling

Behaviour ​

Agree fields use the same checkbox-radio browser behaviour as checkbox groups, but as a single consent option:

  • required handling still applies at the field level
  • checked attributes stay synchronized with live state
  • shared checkbox/radio lifecycle events still come through checkbox-radio

Events ​

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

The formie:field:checkbox-radio:init Event ​

Triggered after the agree field has been wired and its consent checkbox is ready.

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

  // Only target the terms agreement field.
  if (checkboxRadio?.dataset.formieFieldHandle !== 'termsAgreement') {
    return;
  }

  // Mark the field once the consent checkbox is ready.
  checkboxRadio.setAttribute('data-agree-ready', 'true');
});
Last updated: Sep 16, 2026, 3:50 PM