bootstrap_components_toolkit-1.0.0/templates/bootstrap-button.html.twig
templates/bootstrap-button.html.twig
{#
/**
* @file
* Theme template for Bootstrap Button, an extension of Bootstrap Button
*
* Available variables:
* - button_content: The button content. Accepts any rendered array or element.
* - url: An optional url. If not present, it will render a button.
* - type: A valid bootstrap button type: 'outline' or FALSE to default.
* - color: A mandatory valid bootstrap color key.
* - size: A valid bootsptrap size value: 'lg' or 'sm'
*/
#}
{% set component_base = 'btn' %}
{% set attributes = safe_create_attribute(attributes) %}
{%
set merged_classes = [
component_base,
type and color ? [component_base, type, color] | join('-'),
color and not type ? [component_base, color] | join('-'),
size ? 'btn-' ~ size,
] | merge(classes ? classes : [])
%}
{% if url %}
<a{{ attributes.addClass(merged_classes) }} href="{{ url }}">
{% else %}
<button{{ attributes.addClass(merged_classes) }}>
{% endif %}
{% block button_content %}
{{ button_content }}
{% endblock %}
{% if url %}
</a>
{% else %}
</button>
{% endif %}
