Skip to content
kitn AI/UI

Tooltip

kai-tooltip

Wrap a control and it shows a short hint on hover or focus. You give it the trigger and the text; it handles positioning, the open delay, and dismissing on Escape or outside-click.

  • Shadow DOM
  • Hover + focus
  • Self-positioning
  • Text-only hint

Put the trigger in the default slot — any focusable control — and set content to the hint text. The tooltip positions itself next to the trigger, portals its bubble inside the shadow root so it isn’t clipped, and dismisses on Escape or an outside click. Tune the hover delay with openDelay (focus always shows it immediately).

<kai-tooltip content="Voice input">
<kai-button variant="subtle" size="icon" icon="mic" label="Voice input"></kai-button>
</kai-tooltip>

The common case — an icon-only button whose meaning isn’t obvious without a label.

Any focusable control works as the trigger, not just icon buttons.

openDelay sets the hover wait in milliseconds (default 600). Drop it for hints you want to surface faster.

PropertyTypeDefaultNotes
content''The hint text shown on hover/focus of the slotted trigger.
openDelayDelay (ms) before the tooltip appears on hover. Defaults to 600. Focus shows it immediately regardless.
closeDelayDelay (ms) before it hides after the pointer leaves. Defaults to 0 (hides immediately).
placementPreferred placement: `'top' | 'bottom' | 'left' | 'right'` (+ optional `-start`/`-end`). Defaults to `'top'`; flips to stay in view.
openDrive/observe open state (Shoelace-style: settable + reflected to the `open` attribute, the element still self-manages on hover/focus). Set `el.open = true`, or `<kai-tooltip open>`; listen for `kai-open-change`.
defaultOpenInitial open state on mount (uncontrolled seed).
disabledTurn the tooltip off while keeping the trigger mounted (hover/focus and `show()` no longer open it).

This element wraps these SolidJS components — reach for them directly when you need finer control than the props expose.

Tooltip