You are here

views-view-list.html.twig in Drupal 10

Default theme implementation for a view template to display a list of rows.

Available variables:

  • attributes: HTML attributes for the container.
  • rows: A list of rows for this list.
    • attributes: The row's HTML attributes.
    • content: The row's contents.
  • title: The title of this group of rows. May be empty.
  • list: @todo.
    • type: Starting tag will be either a ul or ol.
    • attributes: HTML attributes for the list element.

File

core/modules/views/templates/views-view-list.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation for a view template to display a list of rows.
  5. *
  6. * Available variables:
  7. * - attributes: HTML attributes for the container.
  8. * - rows: A list of rows for this list.
  9. * - attributes: The row's HTML attributes.
  10. * - content: The row's contents.
  11. * - title: The title of this group of rows. May be empty.
  12. * - list: @todo.
  13. * - type: Starting tag will be either a ul or ol.
  14. * - attributes: HTML attributes for the list element.
  15. *
  16. * @see template_preprocess_views_view_list()
  17. *
  18. * @ingroup themeable
  19. */
  20. #}
  21. {% if attributes -%}
  22. <div{{ attributes }}>
  23. {% endif %}
  24. {% if title %}
  25. <h3>{{ title }}</h3>
  26. {% endif %}
  27. <{{ list.type }}{{ list.attributes }}>
  28. {% for row in rows %}
  29. <li{{ row.attributes }}>
  30. {{- row.content -}}
  31. </li>
  32. {% endfor %}
  33. </{{ list.type }}>
  34. {% if attributes -%}
  35. </div>
  36. {% endif %}

Related topics