{#- chirp-ui: Tooltip macro Wraps child, shows tooltip bubble on hover with arrow positioning. Pure CSS. Usage: from "chirpui/tooltip.html" import tooltip {% call tooltip("Copy to clipboard") %} {% end %} {% call tooltip("Below the element", position="bottom") %} Hover me {% end %} Positions: top (default), bottom, left, right Use block=true when the trigger is block-level content such as a full nav row. -#} {% def tooltip(content=none, hint=none, position="top", block=false, cls="") %} {% set tooltip_text = hint if hint is not none else content %} {% set pos = position if position in ("top", "bottom", "left", "right") else "top" %} {% set block_class = " chirpui-tooltip--block" if block else "" %} {% if block %}
{% slot %} {{ tooltip_text }}
{% else %} {% slot %} {{ tooltip_text }} {% end %} {% end %}