button-group.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. {% assign items = items | split: ',' %}
  2. {% assign icons = icons | split: ',' %}
  3. <div class="btn-group{% if include.vertical %}-vertical{% endif %}{% if include.fluid %} w-100{% endif %}"role="group">
  4. {% for item in items %}
  5. {% if include.radio %}
  6. <input type="radio" class="btn-check" name="btn-radio-{{ id }}" id="btn-radio-{{ id }}-{{ forloop.index }}" autocomplete="off"{% if forloop.index == 1 %} checked{% endif %}>
  7. {% endif %}
  8. <{% if include.radio %}label for="btn-radio-{{ id }}-{{ forloop.index }}"{% else %}button{% endif %} type="button" class="btn{% if forloop.index == 1 %}{% unless include.radio %} active{% endunless %}{% endif %}">{{ item }}</{% if include.radio %}label{% else %}button{% endif %}>
  9. {% endfor %}
  10. {% for icon in icons %}
  11. {% if include.radio %}
  12. <input type="radio" class="btn-check" name="btn-radio-{{ id }}" id="btn-radio-{{ id }}-{{ forloop.index }}" autocomplete="off"{% if forloop.index == 1 %} checked{% endif %}>
  13. {% endif %}
  14. <{% if include.radio %}label for="btn-radio-{{ id }}-{{ forloop.index }}"{% else %}button{% endif %} class="btn btn-icon{% if forloop.index == 1 %}{% unless include.radio %} active{% endunless %}{% endif %}">{% include "ui/icon.html" icon=icon %}</{% if include.radio %}label{% else %}button{% endif %}>
  15. {% endfor %}
  16. {% if include.dropdown %}
  17. <div class="btn-group" role="group">
  18. {% if include.radio %}
  19. <input type="radio" class="btn-check" name="btn-radio-{{ id }}" id="btn-radio-{{ id }}-dropdown" autocomplete="off"{% if forloop.index == 1 %} checked{% endif %}>
  20. {% endif %}
  21. <{% if include.radio %}label for="btn-radio-{{ id }}-dropdown"{% else %}button{% endif %} class="btn dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  22. Other
  23. </{% if include.radio %}label{% else %}button{% endif %}>
  24. {% include "ui/dropdown-menu.html" %}
  25. <div class="dropdown-menu dropdown-menu-end">
  26. <a class="dropdown-item" href="#">
  27. Option 4
  28. </a>
  29. <a class="dropdown-item" href="#">
  30. Option 5
  31. </a>
  32. <a class="dropdown-item" href="#">
  33. Option 6dropdown-menu
  34. </a>
  35. </div>
  36. </div>
  37. {% endif %}
  38. </div>