GitHub

Tooltip

Hover and focus tooltip. Wrap a trigger in the default slot and set text. It shows after delay ms (default 200) and hides on leave or blur.

Stable wc import '@esa/ecology/esa-tooltip';

Preview

<esa-tooltip text="Tooltip above" position="above">
  <button>Hover me</button>
</esa-tooltip>

Positions

<esa-tooltip text="Tooltip above" position="above"></esa-tooltip>
<esa-tooltip text="Tooltip below" position="below"></esa-tooltip>
<esa-tooltip text="Left side" position="left"></esa-tooltip>
<esa-tooltip text="Right side" position="right"></esa-tooltip>

Focusable trigger

Any focusable element works — the tooltip shows on focusin as well as hover, so keyboard users get it too.

<esa-tooltip text="Shows on focus too" position="above">
  <a href="#">Tab to me</a>
</esa-tooltip>

API

PropTypeDefaultDescription
text string '' Tooltip label. The tooltip does not render when empty.
position 'above' | 'below' | 'left' | 'right' 'above' Side the tooltip appears on.
delay number 200 Milliseconds to wait before showing on hover/focus.
open boolean false Reflected open state.

Accessibility

  • The bubble is role="tooltip" and is pointer-events: none so it never intercepts clicks.
  • Shows on both hover and focus, so keyboard users see the same hint as pointer users.
  • Tooltips supplement — they should not be the only place critical information lives.

Theming surface

Every public token this component reads, extracted from its source at build time. The Resolves to column walks each token's real lineage — component → semantic → primitive → raw value — so you can see exactly where re-pointing it lands. A spoke re-skins by overriding these in its theme-<slug>.css; component internals are never edited. No hook for what you need? File it with /request-lego.

TokenTierResolves to
--tooltip-bg component #202020 via --color-gray-12
--tooltip-color component #fcfcfc via --color-text-inverse--color-gray-1
--tooltip-max-width component 240px
--tooltip-radius component 0.25rem via --radius-100
--font-sans semantic 'DM Sans', sans-serif
--line-height-tight semantic 1.3
--type-size-150 semantic clamp(0.6875rem, 0.61rem + 0.38vw, 0.875rem)
--shadow-100 primitive 0 2px 12px 0 rgba(0, 0, 0, 0.04)
--spacing-100 primitive 0.25rem
--spacing-200 primitive 0.5rem
--z-tooltip primitive 600