You are here

uikit-view-accordion.html.twig in UIkit Components 8.2

Same filename and directory in other branches
  1. 8.3 uikit_views/templates/views/uikit-view-accordion.html.twig

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.
  • accordion_toggle: The class to use as the accordion toggle.
  • accordion_container: The class to use as the accordion content container.

File

uikit_views/templates/views/uikit-view-accordion.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. * - accordion_toggle: The class to use as the accordion toggle.
  13. * - accordion_container: The class to use as the accordion content container.
  14. *
  15. * @see template_preprocess_uikit_view_accordion()
  16. */
  17. #}
  18. {{ attach_library('uikit/uikit.accordion') }}
  19. {% if title %}
  20. <h3>{{ title }}</h3>
  21. {% endif %}
  22. <div{{ accordion_attributes }}>
  23. {% for row in items %}
  24. <h3 class="{{ accordion_toggle }}">{{ row.title }}</h3>
  25. <div class="{{ accordion_container }}">{{ row.content }}</div>
  26. {% endfor %}
  27. </div>