card-tabs.html 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. {% assign tabs-count = include.count | default: 3 %}
  2. {% assign id = include.id | default: 'top' %}
  3. {% assign tabs = (1..tabs-count) %}
  4. {% capture tabs-html %}
  5. <!-- Cards navigation -->
  6. <ul class="nav nav-tabs{% if include.bottom %} nav-tabs-bottom{% endif %}">
  7. {% for tab in tabs %}
  8. <li class="nav-item"><a href="#tab-{{ id }}-{{ tab }}" class="nav-link{% if forloop.first %} active{% endif %}" data-bs-toggle="tab">Tab {{ tab }}</a></li>
  9. {% endfor %}
  10. </ul>
  11. {% endcapture %}
  12. {% capture tabs-content-html %}
  13. <div class="tab-content">
  14. {% for tab in tabs %}
  15. <!-- Content of card #{{ tab }} -->
  16. <div id="tab-{{ id }}-{{ tab }}" class="card tab-pane{% if forloop.first %} active show{% endif %}">
  17. <div class="card-body">
  18. <div class="card-title">Content of tab #{{ tab }}</div>
  19. <p class="text-secondary">
  20. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Adipisci, alias aliquid distinctio dolorem expedita, fugiat hic magni molestiae molestias odit.
  21. </p>
  22. </div>
  23. </div>
  24. {% endfor %}
  25. </div>
  26. {% endcapture %}
  27. <!-- Cards with tabs component -->
  28. <div class="card-tabs{% if include.borderless %} border-0{% endif %}">
  29. {% if include.bottom %}
  30. {{ tabs-content-html }}
  31. {{ tabs-html }}
  32. {% else %}
  33. {{ tabs-html }}
  34. {{ tabs-content-html }}
  35. {% endif %}
  36. </div>