{% load wagtailadmin_tags %}
<ul class="tab-nav merged">
    {% for child in self.children %}
        <li class="{{ child.classes|join:" " }} {% if forloop.first %}active{% endif %}"><a href="#{{ child.heading|cautious_slugify }}" class="{% if forloop.first %}active{% endif %}">{{ child.heading }}</a></li>
    {% endfor %}
</ul>

<div class="tab-content">
    {% for child in self.children %}
        <section id="{{ child.heading|cautious_slugify }}" class="{{ child.classes|join:" " }} {% if forloop.first %}active{% endif %}">
            {{ child.render_as_object }}
        </section>
    {% endfor %}
</div>