Sha256: bb49ae3072eeba4130783dae61b3481dfa90be2e836bd86ec7b4f0f9eaca4d50

Contents?: true

Size: 1.52 KB

Versions: 37

Compression:

Stored size: 1.52 KB

Contents

{#- 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 -%}

<div {%- if params.id %} id="{{params.id}}"{% endif %} class="govuk-tabs {%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %} data-module="govuk-tabs">
  <h2 class="govuk-tabs__title">
    {{ params.title | default ("Contents") }}
  </h2>
  {% if(params.items) %}
  <ul class="govuk-tabs__list">
    {% for item in params.items %}
      {% if item %}
        {% set id = item.id if item.id else idPrefix + "-" + loop.index %}
        <li class="govuk-tabs__list-item{% if loop.index == 1 %} govuk-tabs__list-item--selected{% endif %}">
          <a class="govuk-tabs__tab" href="#{{ id }}"
            {%- for attribute, value in item.attributes %} {{attribute}}="{{value}}"{% endfor %}>
            {{ item.label }}
          </a>
        </li>
      {% endif %}
    {% endfor %}
  </ul>
  {% endif %}
  {% for item in params.items %}
    {% if item %}
      {% set id = item.id if item.id else idPrefix + "-" + loop.index %}
      <section class="govuk-tabs__panel{% if loop.index > 1 %} govuk-tabs__panel--hidden{% endif %}" id="{{ id }}"{% for attribute, value in item.panel.attributes %} {{attribute}}="{{value}}"{% endfor %}>
        {{ item.panel.html | safe if item.panel.html else item.panel.text }}
      </section>
    {% endif %}
  {% endfor %}
</div>

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
govuk_publishing_components-21.20.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.19.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.19.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.18.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.17.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.16.3 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.16.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.16.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.16.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.15.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.15.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.15.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.14.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.5 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.4 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.3 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.13.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-21.12.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk