<!-- Basic tooltip -->
<button tooltip="Save your changes">Save</button>
<!-- Positioned below -->
<button tooltip="More options" tooltip-position="bottom">Menu</button>
<!-- Custom delay (500ms) -->
<button tooltip="Delete this item" tooltip-delay="500">Delete</button>
<!-- Tooltip on an icon -->
<span tooltip="Notifications" tooltip-position="right">🔔</span>| Attribute | Type | Default | Description |
|---|---|---|---|
tooltip |
string | required | The text content displayed in the tooltip |
tooltip-position |
"top" | "bottom" | "left" | "right" |
"top" |
Placement relative to the trigger element |
tooltip-delay |
number (ms) | 300 |
Delay in milliseconds before the tooltip appears |
tooltip-disabled |
expression | — | Reactive boolean expression. When truthy, prevents tooltip from showing |
| Class | When Applied |
|---|---|
.nojs-tooltip |
On the generated tooltip element (injected via <style data-nojs-tooltip>) |
Override in your own stylesheet to customize appearance (background, color, padding, border-radius, etc.).
role="tooltip"on the tooltip elementaria-hidden="true/false"reflecting visibility statearia-describedbyon the trigger, pointing to the tooltipid- Escape dismisses a visible tooltip when the trigger has focus
- Tooltips show on
focusinand hide onfocusout, making them keyboard-accessible
Tooltips are positioned using viewport-aware calculations:
- Placed relative to the trigger based on the
tooltip-positionattribute - An 8px gap separates the tooltip from the trigger
- The position is clamped to keep a 4px margin from viewport edges
Next: Popover -->