{% load wagtailadmin_tags %}
{# Avoid semantic markup here. Children of this panel can either be fields, or other groups. #}
{% for child in self.visible_children %}
    <div class="w-panel__wrapper {{ child.classname }}">
        {% if child.heading %}
            {% fragment as label_content %}
                {{ child.heading }}{% if child.is_required %}<span class="w-required-mark">*</span>{% endif %}
            {% endfragment %}
            {% if child.id_for_label %}
                <label class="w-field__label" for="{{ child.id_for_label }}" id="{{ child.id_for_label }}-label">{{ label_content }}</label>
            {% else %}
                <h3 class="w-field__label">{{ label_content }}</h3>
            {% endif %}
        {% endif %}

        {% component child %}
    </div>
{% endfor %}
