Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

API REFERENCE · OVERLAYS

<dj-tooltip>

Shows tip content next to its trigger on hover/focus. The trigger goes in the default slot, the tip in the content slot. Set open to force it shown. Escape hides a tip that hover or focus showed, without moving the pointer or focus; entering or focusing the trigger again shows it again. When a tooltip is open over a dialog, Escape hides the tip first and leaves the dialog open.

The tip describes its trigger: the slotted trigger element gets aria-describedby pointing at the slotted tip (an id is generated for the tip when it has none). Put the tooltip around an element that carries the role, such as a native <button>; a custom element whose focusable part sits in its own shadow root cannot receive the reference.

The tip renders in the browser top layer where the Popover API exists, so an overflow: hidden or transformed ancestor cannot clip it. It sits on the orientation side and flips to the opposite side when there is no room there, then stays inside the viewport.

Try it in the playground

@dojo-ng/tooltip · v0.1.3

npm install @dojo-ng/tooltip

import "@dojo-ng/tooltip";

Properties

PropertyAttributeTypeDefault
openForce the tooltip open regardless of hover/focus. open boolean false
orientation orientation reflected "top""right""bottom""left" "top"

Slots

Default slotcontent

CSS parts

Style these with dj-tooltip::part(name).

content

CSS custom properties

PropertyDefaultDescription
--dj-tooltip-z-index950Stacking order of the tooltip.