{% if variant and variant|lower != 'default' %}
  {% set variants = variant|split('__')|map(v => v|lower|replace({(v): 'fr-alert--' ~ v})|replace({_: '-'})) %}
  {% set attributes = attributes.addClass(variants) %}
{% endif %}

{% set title_tag = title_tag|default('h3') %}

<div{{ attributes.addClass('fr-alert') }}>
  {% if title %}
    <{{ title_tag }} class="fr-alert__title">{{ title }}</{{ title_tag }}>
  {% endif %}
    {{ message }}
  {% if dismissible %}
    {% set close_title = close_title|default('Close'|t) %}
    <button{% if dismissible == 'core' %} onclick="const alert = this.parentNode; alert.parentNode.removeChild(alert);"{% endif %} class="fr-btn fr-btn--close" title="{{ close_title }}">{{ close_title }}</button>
  {% endif %}
</div>
