{# Even when hidden, the label should be output for accessibility #}
{% if labelPosition.shouldDisplay(position) or (labelPosition == 'hidden' and position == 'above') %}
    {% fieldtag 'fieldLabel' %}
        {{- field.label | t('formie') | raw -}}

        {%- set isRequired = (field.isRequired ?? required ?? null) -%}

        {%- if form.settings.requiredIndicator == 'asterisk' and isRequired -%}
            &nbsp;{{ fieldtag('fieldRequired', { text: '*' | t('formie') }) }}
        {%- elseif form.settings.requiredIndicator == 'optional' and isRequired is same as(false) -%}
            &nbsp;{{ fieldtag('fieldOptional', { text: '(optional)' | t('formie') }) }}
        {%- endif -%}

        {# Allow extra content to be passed in #}
        {%- set labelExtraContent = labelExtraContent ?? renderOptions.labelExtraContent ?? null -%}

        {%- if labelExtraContent -%}
            {{ labelExtraContent | raw }}
        {%- endif -%}
    {% endfieldtag %}
{% endif %}
