{#
/**
 * @file
 * Template for a Bootstrap 5 Button.
 *
 * Available variables:
 * - text: The button label text.
 * - url: (optional) URL destination. If omitted, renders a <button> element.
 * - variant: Bootstrap color variant (primary, secondary, etc.).
 * - size: Button size modifier (default, sm, lg).
 * - outline: (boolean) Apply outline/ghost style instead of solid fill.
 * - custom_class: Additional CSS classes.
 *
 * @ingroup themeable
 */
#}

{# Normalize props #}
{% set button_variant = variant|default('primary') %}
{% set button_size = size|default('default') %}
{% set outline_class = outline ? 'btn-outline-' ~ button_variant : 'btn-' ~ button_variant %}
{% set size_class = button_size != 'default' ? 'btn-' ~ button_size : '' %}
{% set btn_classes = ['btn', outline_class, size_class, custom_class|default('')]|filter(v => v)|join(' ') %}

{% if url %}
  <a href="{{ url }}" class="{{ btn_classes }}">
    {{ text }}
  </a>
{% else %}
  <button type="button" class="{{ btn_classes }}">
    {{ text }}
  </button>
{% endif %}
