Schema
Mocks
Template
{% set tag = url ? "a" : "button" %}
<{{ tag }}
{{ attributes }}
class="
Button
{% if icon_only %}Button--iconOnly{% endif %}
{% for modifier in modifiers %} Button--{{ modifier }}{% endfor %}
{{ classes|join(" ") }}
"
{% if tag == "button" %}
type="{{ type|default("button") }}"
{% if disabled %} disabled{% endif %}
{% else %}
href="{{ url }}"
{% if target %}target="{{ target }}"{% endif %}
{% endif %}
{% if hidden %}hidden{% endif %}
>
{% if icon and icon|trim|length > 0 %}
<span class="Button-icon">
{% include "@elements/icon/icon.twig" with {
name: icon,
} only %}
</span>
{% endif %}
<span class="Button-label{% if icon_only %} u-hiddenVisually{% endif %}">
{{ label }}
</span>
</{{ tag }}>