display_builder-1.0.x-dev/components/shoelace/button/button.twig
components/shoelace/button/button.twig
{% set attributes = attributes.addClass('db-button') %}
{% set attributes = (variant and variant != 'default') ? attributes.setAttribute('variant', variant) : attributes %}
{% set attributes = id ? attributes.setAttribute('id', 'db-' ~ id) : attributes %}
{% if tooltip %}
<sl-tooltip>
<div slot="content">{{ tooltip }}</div>
{% if icon %}
<sl-icon name="{{ icon }}" label="{{ label }}"></sl-icon>
{% endif %}
<sl-button{{ attributes }} name="{{ icon }}" label="{{ label }}">{{ label }}</sl-button>
</sl-tooltip>
{% else %}
<sl-button{{ attributes }}>
{% if icon %}
<sl-icon name="{{ icon }}"></sl-icon>
{% endif %}
{{ label }}
</sl-button>
{% endif %}
