You are here

uikit-view-switcher.html.twig in UIkit Components 8.3

Theme override for a view template to display an accordion of rows.

Available variables:

  • accordion_attributes: HTML attributes for the container.
  • items: A list of rows for this accordion.
    • title: The row's title.
    • content: The row's contents.
  • title: The title of this group of rows. May be empty.

File

uikit_views/templates/views/uikit-view-switcher.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Theme override for a view template to display an accordion of rows.
  5. *
  6. * Available variables:
  7. * - accordion_attributes: HTML attributes for the container.
  8. * - items: A list of rows for this accordion.
  9. * - title: The row's title.
  10. * - content: The row's contents.
  11. * - title: The title of this group of rows. May be empty.
  12. *
  13. * @see template_preprocess_uikit_view_accordion()
  14. */
  15. #}
  16. {% set switcher_classes = [
  17. 'uk-subnav',
  18. 'uk-subnav-pill',
  19. 'uk-flex',
  20. 'uk-flex-center',
  21. ]
  22. %}
  23. {% if title %}
  24. <h3>{{ title }}</h3>
  25. {% endif %}
  26. <ul{{ switcher_attributes.addClass(switcher_classes) }}>
  27. {% for row in items %}
  28. <li><a href="#" class="uk-border-pill">{{ row.title }}</a></li>
  29. {% endfor %}
  30. </ul>
  31. <ul class="uk-switcher uk-margin">
  32. {% for row in items %}
  33. <li>{{ row.content }}</li>
  34. {% endfor %}
  35. </ul>