{#
chip.html — Filter/Tag-Chip
Props:
label : Anzeigetext
active : bool — ob der Chip selektiert ist (default False)
variant : "default" | "green" | "dark"
href : Optionaler Link. Ohne href wird ein gerendert.
attrs : Optionaler Dict mit zusätzlichen HTML-Attributen (z.B. data-*)
Verwendung:
{% from "v2/components/chip.html" import chip %}
{{ chip("Bundesweit", active=True) }}
{{ chip("BW", href="/v2?bl=BW") }}
{{ chip("Score 8–10", active=True, variant="green") }}
#}
{% macro chip(label, active=False, variant="default", href="", attrs={}) %}
{% set classes = "v2-chip" %}
{% if variant != "default" %}{% set classes = classes ~ " " ~ variant %}{% endif %}
{% if active %}{% set classes = classes ~ " active" %}{% endif %}
{% if href %}
{{ label }}
{% else %}
{{ label }}
{% endif %}
{% endmacro %}