List with No Wrapping
Prevent List Items from wrapping with the nowrap
prop.
Important Notes:
The nowrap
prop only works when the display
prop is set to horizontal
.
This prop prevents List Items from wrapping, which means they can potentially overflow the parent container.
View the following List in different viewports to observe the behavior.
Demo
Horizontal list with nowrap
-
Item 1
-
Item 2
-
Item 3
-
Item 4
-
Item 5
-
Item 6
-
Item 7
-
Item 8
-
Item 9
Twig
{% set list_items %}
{% include '@bolt-elements-list/list-item.twig' with {
content: placeholder_1,
} only %}
{% include '@bolt-elements-list/list-item.twig' with {
content: placeholder_2,
} only %}
{% include '@bolt-elements-list/list-item.twig' with {
content: placeholder_3,
} only %}
...
{% endset %}
{% include '@bolt-elements-list/list.twig' with {
display: 'horizontal',
nowrap: true,
content: list_items
} only %}
HTML
<ul class="e-bolt-list e-bolt-list--display-horizontal e-bolt-list--nowrap">
<li class="e-bolt-list__item">First item</li>
<li class="e-bolt-list__item">Second item</li>
<li class="e-bolt-list__item">Third item</li>
<li class="e-bolt-list__item">Fourth item</li>
<li class="e-bolt-list__item">Fifth item</li>
<li class="e-bolt-list__item">Sixth item</li>
<li class="e-bolt-list__item">Seventh item</li>
<li class="e-bolt-list__item">Eighth item</li>
<li class="e-bolt-list__item">Ninth item</li>
</ul>