<img>
element is also acceptable.
size
and background
props for the icon component are not well supported in this scenario.<span class="e-bolt-button__icon-before">
and <span class="e-bolt-button__icon-after">
are required to wrap around the icon markup. The wrapper ensures that the icon will always wrap with the final word of the text. It will never wrap to the next line on its own.
// Icon vars
{% set icon_custom %}
<img src="/images/placeholders/500x500.jpg">
{% endset %}
{% set icon_chevron_down %}
{% include '@bolt-elements-icon/icon.twig' with {
name: 'chevron-down',
} only %}
{% endset %}
// Button include
{% include '@bolt-elements-button/button.twig' with {
content: 'This is a button with icons before and after',
icon_before: icon_custom,
icon_after: icon_chevron_down,
attributes: {
type: 'button'
}
} only %}
<button type="button" class="e-bolt-button"><span class="e-bolt-button__icon-before"><!-- Icon or image markup --></span>This is a button with icons before and after<span class="e-bolt-button__icon-after"><!-- Icon or image markup --></span></button>