{% macro govukTabs(params) %} {% from "govuk_frontend_jinja/macros/attributes.html" import govukAttributes %} {%- macro _tabListItem(params, item, index) %} {% set tabPanelId = item.id if item.id else idPrefix + "-" ~ index -%}
  • {{ item.label }}
  • {% endmacro -%} {%- macro _tabPanel(params, item, index) %} {% set tabPanelId = item.id if item.id else idPrefix + "-" ~ index -%}
    {% if item.panel.html %} {{ item.panel.html | safe | trim | indent(2) }} {% elif item.panel.text %}

    {{ item.panel.text }}

    {% endif %}
    {% endmacro -%} {#- If an id 'prefix' is not passed, fall back to using the name attribute instead. We need this for error messages and hints as well -#} {% set idPrefix = params.idPrefix if params.idPrefix -%}

    {{ params.title | default ("Contents") }}

    {% if 'items' in params and params['items'] | length %} {% for item in params['items'] %} {% if item %} {{- _tabPanel(params, item, loop.index) | trim | indent(2, true) }} {% endif %} {% endfor %} {% endif %}
    {% endmacro %}