{{ cms_list(name, { ordered: ..., items: [ '...', '...' ], class: '...' }) }}
Argument | Description | Data Type |
---|---|---|
name | The element identifier | String |
ordered (optional) | Set ordered list or unordered list | Boolean |
items (optional) | Array containing the content of each list item | Array[String] |
class (optional) | A space-separated list of CSS classes to style the list component | String |
The class
variable is only accessible in the code. All other variables are available in the Canopy editor.
List component template
<{{ ordered ? 'ol' : 'ul' }} class={{ class }}>
{% for item in items %}
<li>{{ item }}</li>
{% endfor %}
</{{ ordered ? 'ol' : 'ul' }}>
Rendered HTML output
<ol class="bg-pink">
<li>Item 1</li>
<li>Item 2</li>
</ol>
Example
{{ cms_list('list-tag-123', { ordered: true, items: [ 'Item 1', 'Item 2', 'Item 3' ], class: 'list-decimal pl-5 space-y-2' }) }}