Sha256: c8751ba9457a353d1781eab29bebe2f8d6edc6168da8d5f2d3e114d7481a1d7c

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 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 %}
    {% 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>
    {% endfor %}
  </ul>
  {% endif %}
  {% for item in params.items %}
  {% 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>
  {% endfor %}
</div>

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
govuk_publishing_components-20.5.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.5.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.4.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.3.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.2.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.2.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.2.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.1.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-20.0.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-19.0.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.3.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.3.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.2.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.1.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.1.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.1.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.0.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-18.0.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk