<div class="govuk-form-group">
  {% if not form.earliest_expression.data %}
    {% set addDataButton %}
      {{ form.add_context(params={"html": "Reference data <span class='govuk-visually-hidden'>for earliest date</span>", "classes": "govuk-button--secondary govuk-!-margin-bottom-0 govuk-!-margin-top-6", "value": "earliest_expression"}) }}
    {% endset %}
    {{ form.earliest_value(params={"formGroup": {"afterInputs": {"html": addDataButton } } }) }}
  {% else %}
    {% set removeDataButton %}
      {{ form.remove_context(params={"html": "Remove data <span class='govuk-visually-hidden'>reference for earliest date</span>", "classes": "govuk-button--secondary govuk-!-margin-bottom-0", "value": "earliest_expression"}) }}
    {% endset %}
    <div data-module="context-aware-editor" data-toolbar-enabled="false" data-i18n="{}" data-wrapper-classes="govuk-input--width-20">
      <div class="govuk-!-display-none" data-context nonce="{{ csp_nonce() }}">{{ g.context_keys_and_labels | tojson }}</div>
      {{ form.earliest_expression(params={"classes": "govuk-!-margin-bottom-0", "attributes": {"data-context-aware-editor-target": "", "readonly": ""}, "formGroup": {"classes": "app-context-aware--container", "afterInput": {"html": removeDataButton } } }) }}
    </div>
  {% endif %}

  {{ form.earliest_inclusive() }}
</div>
