{# Macro button / link_button / icon_button Uso: {% from "dg/components/button.html" import button, link_button, icon_button %} {{ button("Crear", variant="primary") }} {{ link_button("Ver", href="/x", variant="ghost") }} {{ icon_button("plus", aria_label="Nuevo") }} #} {% macro button( label, variant="ghost", size="md", type="button", icon=none, icon_position="left", aria_label=none, disabled=false, extra_class="", attrs="" ) %} {%- set _size = " btn-sm" if size == "sm" else "" -%} {%- set _var = "btn-" ~ variant -%} {%- endmacro %} {% macro link_button( label, href="#", variant="ghost", size="md", icon=none, icon_position="left", target="", aria_label=none, extra_class="" ) %} {%- set _size = " btn-sm" if size == "sm" else "" -%} {%- set _var = "btn-" ~ variant -%} {%- if icon and icon_position == "left" %} {%- from "dg/components/icon.html" import icon as _icon %} {{ _icon(icon, class="w-4 h-4") }} {%- endif %} {{- label -}} {%- if icon and icon_position == "right" %} {%- from "dg/components/icon.html" import icon as _icon %} {{ _icon(icon, class="w-4 h-4") }} {%- endif %} {%- endmacro %} {% macro icon_button(name, aria_label, extra_class="", attrs="") %} {%- from "dg/components/icon.html" import icon %} {%- endmacro %}