A lightweight floating hint component for short contextual help.
Quickstart
<rtgl-button id="help-btn">Show Tooltip</rtgl-button>
<rtgl-tooltip id="tooltip" content="Helpful context" place="t"></rtgl-tooltip>
<script>
const button = document.getElementById("help-btn");
const tooltip = document.getElementById("tooltip");
button.addEventListener("click", () => {
const rect = button.getBoundingClientRect();
if (tooltip.hasAttribute("open")) {
tooltip.removeAttribute("open");
return;
}
tooltip.setAttribute("x", String(rect.left + rect.width / 2));
tooltip.setAttribute("y", String(rect.top - 2));
tooltip.setAttribute("open", "");
});
</script>
API
| Name | Attribute | Type | Default |
|---|---|---|---|
| Open | open |
boolean | - |
| Position X | x |
number | 0 |
| Position Y | y |
number | 0 |
| Place | place |
popover place token (t, ts, te, r, rs, re, b, bs, be, l, ls, le) |
t |
| Size | s |
sm, md, lg |
sm |
| Content | content |
string | "" |
Behavior
Behavior & precedence
- Controlled by
open. - Uses explicit
x/ypositioning. placecontrols orientation relative to anchor point.scontrols tooltip padding, text scale, and max width presets.- Opens in the browser top layer, so it paints above open dialogs and popovers
wherever it sits in the DOM, and is not clipped by transformed or
overflow: hiddenancestors. The page beneath stays interactive. - Browsers without the Popover API (before Safari 17, Chrome 114, Firefox 125) open it as a non-modal dialog instead; there, place the tooltip inside an open dialog or popover so it renders above it.