<!-- Work-around until fix merged into mkdocs material -->
<!-- https://github.com/squidfunk/mkdocs-material/discussions/5048 -->

{% block tab_items %}
  {% if not class %}
  {% set class = "md-tabs__link" %}
  {% set item_class = "md-tabs__item" %}
  {% if nav_item.active %}
    {% set class = class ~ " md-tabs__link--active" %}
    {% set item_class = item_class ~ " md-tabs__item--active" %}
  {% endif %}
  {% endif %}

  <!-- Main navigation item with nested items -->
  {% if nav_item.children %}
  {% set title = title | d(nav_item.title) %}
  {% set nav_item = nav_item.children | first %}

  <!-- Recurse, if the first item has further nested items -->
  {% if nav_item.children %}
    {% include "partials/tabs-item.html" %}

  <!-- Render item -->
  {% else %}
    <li class="{{ item_class }}">
      <a href="{{ nav_item.url | url }}" class="{{ class }}">
        {{ title }}
      </a>
    </li>
  {% endif %}

  <!-- Main navigation item -->
  {% else %}
  <li class="{{ item_class }}">
    <a href="{{ nav_item.url | url }}" class="{{ class }}">
      {{ nav_item.title }}
    </a>
  </li>
  {% endif %}
{% endblock %}