Sha256: 3d022678ab8f044b2afa93119cf7563d9d42dfb6eac84408260756c99d7a8215

Contents?: true

Size: 1.52 KB

Versions: 253

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 | 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 %}>
        {{ item.panel.html | safe if item.panel.html else item.panel.text }}
      </div>
    {% endif %}
  {% endfor %}
</div>

Version data entries

253 entries across 253 versions & 2 rubygems

Version Path
defra_ruby_template-3.15.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
defra_ruby_template-3.15.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.4.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.4.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.3.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.2.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.2.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.1.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-30.0.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.15.3 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.15.2 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.15.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.15.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.14.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.13.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.12.1 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.12.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.11.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.10.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk
govuk_publishing_components-29.9.0 node_modules/govuk-frontend/govuk/components/tabs/template.njk