{#
/**
 * @file
 * Template for a Bootstrap 5 Badge.
 *
 * Available variables:
 * - attributes: HTML attributes for the badge element.
 * - text: The badge label text. Required.
 * - variant: Bootstrap color variant using text-bg-{variant} helper.
 * - pill: (boolean) Apply rounded-pill style for a pill-shaped badge.
 * - visually_hidden_text: Screen-reader-only text for accessibility context.
 * - custom_class: Additional CSS classes for the badge element.
 *
 * @ingroup themeable
 */
#}

{% set variant = variant|default('primary') %}

{% set classes = [
  'badge',
  'text-bg-' ~ variant,
  pill ? 'rounded-pill' : '',
  custom_class|default(''),
]|filter(v => v) %}

<span{{ attributes.addClass(classes) }}>
  {{ text }}
  {% if visually_hidden_text %}
    <span class="visually-hidden">{{ visually_hidden_text }}</span>
  {% endif %}
</span>
