Sha256: 9a7aaae14fb105f001fcdd0fff80d8bcf39bfae60ed379b0f8bbf11523aa0ce9

Contents?: true

Size: 1.19 KB

Versions: 86

Compression:

Stored size: 1.19 KB

Contents

<%
  tabs ||= []
  panel_border ||= true unless panel_border == false
  panel_css_classes = %w(govuk-tabs__panel)
  panel_css_classes << "gem-c-tabs__panel--no-border" if panel_border == false
  panel_css_classes = panel_css_classes.join(" ")
%>
<% if tabs.count > 1 %>
  <div class="govuk-tabs gem-c-tabs" data-module="tabs">
    <h2 class="govuk-tabs__title">
      Contents
    </h2>
    <ul class="govuk-tabs__list">
      <% tabs.each do |tab| %>
      <li class="govuk-tabs__list-item">
        <%= link_to(tab[:label],
                    "##{tab[:id]}",
                    class: "govuk-tabs__tab",
                    data: tab[:tab_data_attributes]) %>
      </li>
      <% end %>
    </ul>
    <% tabs.each do |tab| %>
      <section class="<%= panel_css_classes %>" id="<%= tab[:id] %>">
        <% if tab[:title] %>
          <h2 class="govuk-heading-l"><%= tab[:title] %></h2>
        <% end %>
        <%= tab[:content] %>
      </section>
    <% end %>
  </div>
<% end %>
<% if tabs.count == 1 %>
    <section id="<%= tabs[0][:id] %>">
      <% if tabs[0][:title] %>
        <h2 class="govuk-heading-l"><%= tabs[0][:title] %></h2>
      <% end %>
      <%= tabs[0][:content] %>
    </section>
<% end %>

Version data entries

86 entries across 86 versions & 1 rubygems

Version Path
govuk_publishing_components-17.21.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.20.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.19.1 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.19.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.18.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.17.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.16.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.15.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.14.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.13.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.12.2 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.12.1 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.12.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.11.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.10.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.9.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.8.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.7.0 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.6.1 app/views/govuk_publishing_components/components/_tabs.html.erb
govuk_publishing_components-17.6.0 app/views/govuk_publishing_components/components/_tabs.html.erb