{% macro toaster( id="toaster", toasts=[], main_attrs=None, is_fragment=false ) %} {% if not is_fragment and registerComponent('toast') %} {% endif %} {% set iconMapping = { 'error': 'circle-x', 'success': 'circle-check', 'info': 'info', 'warning': 'circle-alert' } %}
{% for toast in toasts %}
{% if toast.category in ["error", "success", "info", "warning"] %} {% lucide iconMapping[toast.category], class="size-4 shrink-0" %} {% endif %}
{% if toast.message is string %}

{{ toast.message }}

{% elif toast.message is mapping %} {% if toast.message.title %}

{{ toast.message.title }}

{% endif %} {% if toast.message.description %}

{{ toast.message.description }}

{% endif %} {% endif %}
{% if toast.message.action or toast.message.cancel %} {% endif %}
{% endfor %}
{% endmacro %}