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 customize 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 behavior

Field input

AttributePurposeImportance
data-formie-agree-inputConsent checkbox selectorRequired for agree behavior
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 behavior 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

Behavior

Agree fields use the same checkbox-radio browser behavior 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: May 6, 2026, 3:46 PM