{#- Tooltips and keyboard hints. These take only class (appended to their own classes), not the attrs and kwargs of the other components. tooltip(text, placement="right", when="true", class="") Wraps its {% call %} block, which must be a single element (the trigger), and shows text next to it on hover and keyboard focus; Esc hides it. placement: an x-anchor placement (see components/menu.html). when is an Alpine expression that gates the tooltip, for example "collapsed" to show it only in the sidebar rail. The tooltip has role="tooltip" and the trigger gets aria-describedby pointing at it. class goes on the tooltip. The wrapper uses display: contents, so the trigger keeps its place in the layout. kbd(text, class="") A keyboard key or shortcut, such as "⌘K" or "Esc". Examples: {% call m.tooltip("Users", when="collapsed") %}…{% endcall %} {{ m.kbd("⌘K") }} -#} {% set _placements = { "top": "top", "top-start": "top-start", "top-end": "top-end", "right": "right", "right-start": "right-start", "right-end": "right-end", "bottom": "bottom", "bottom-start": "bottom-start", "bottom-end": "bottom-end", "left": "left", "left-start": "left-start", "left-end": "left-end", } %} {% macro tooltip(text, placement="right", when="true", class="") -%} {%- set position = hx_pick(_placements, placement, "placement") -%} {{- caller() -}} {{ text }} {%- endmacro %} {% macro kbd(text, class="") -%} {{ text }} {%- endmacro %}