dsfr4drupal-1.x-dev/components/badge/badge.twig
components/badge/badge.twig
{% set attributes = attributes|default(create_attribute()) %}
{% set has_icon = has_icon ?? true %}
{% if variant and variant != 'md' %}
{% set attributes = attributes.addClass('fr-badge--' ~ variant) %}
{% endif %}
{% if system_type %}
{% set attributes = attributes.addClass('fr-badge--' ~ system_type) %}
{% if not has_icon %}
{% set attributes = attributes.addClass('fr-badge--no-icon') %}
{% endif %}
{% else %}
{% if color_schema %}
{% set attributes = attributes.addClass('fr-badge--' ~ color_schema) %}
{% endif %}
{% if has_icon and icon %}
{% set attributes = attributes.addClass(['fr-badge--icon-left', 'fr-icon-' ~ icon]) %}
{% endif %}
{% endif %}
<p{{ attributes.addClass('fr-badge') }}>
{% if ellipsis %}
<span class="fr-ellipsis">
{% endif %}
{{- label -}}
{% if ellipsis %}
</span>
{% endif %}
</p>
