Sha256: 90c308e20cb74fdf0db09c65b0a32dcf12f064c05f368b5a2ad637923140abf5

Contents?: true

Size: 1.63 KB

Versions: 51

Compression:

Stored size: 1.63 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 | length) %}
  <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 %}
      <div 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 %}>
        {% if item.panel.html %}
          {{ item.panel.html | safe }}
        {% elif item.panel.text %}
          <p class="govuk-body">{{ item.panel.text }}</p>
        {% endif %}
      </div>
    {% endif %}
  {% endfor %}
</div>

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
govuk_publishing_components-35.3.3 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.3.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.3.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.3.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.2.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.1.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.1.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-35.0.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.14.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.13.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.12.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.11.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.10.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.10.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.9.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.9.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.8.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.8.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.7.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-34.7.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk