Skip to content

GhostTooltip ​

GhostTooltip shows supplemental description text on pointer hover or keyboard focus without moving focus. Import GhostTooltip, GhostTooltipTrigger, and GhostTooltipContent from @ghostvue/themes for the default compact elevation surface. To style the label yourself, see Advanced: headless composition.

Describe dashboard actions ​

Dashboard action tips

Deploy actions and a metric help button whose tooltips open on hover or keyboard focus, share provider timing, and hide on Escape.

Production edgeHealthy
Latency p95
42 ms
Hover or Tab to a control for details. Press Escape to hide a tip.

The tooltip parts in this example come from @ghostvue/themes. Press Tab to reach Copy SHA: its tip appears after a short delay and is linked to the button through aria-describedby. Focus stays on the button, so Enter still copies. Press Escape to hide the tip while keeping focus, or Tab onward to Rebuild and the metric help button, whose tips replace it. Leaving a trigger hides its tip after the close delay. The status footer shows the result of each action, because a tooltip only adds a description and never replaces the control's own label.

Importing from @ghostvue/themes loads default.css, styling .ghost-tooltip-content with elevation-2 surface, hairline border, radius, inset padding, and small type tokens. Tooltip content uses pointer-events: none so it never intercepts pointer input unless hoverable content is enabled.

Timing and the shared provider ​

A tooltip waits delayDuration before it opens and closeDelay (300 ms by default) before it hides, so a pointer can cross to the tip without losing it (WCAG 1.4.13). The two actions in the example share a GhostTooltipProvider with a 300 ms open delay. When the pointer moves to the other action while a tip is open, or within skipDelayDuration (250 ms here) after it closes, the next tip opens at once and the previous tip hides without waiting for its closeDelay, so only one message is on screen. The first tip in a provider still waits the full delay, and keyboard focus keeps per-root timing. The metric help button sits outside the provider and waits the 700 ms default.

GhostTooltipProvider renders no element and has no themed styles, so it is imported from @ghostvue/vue even when the tooltips come from @ghostvue/themes.

Escape and other overlays ​

An open tooltip joins the shared overlay layer stack for Escape only. When a tooltip is open inside (or above) a GhostDialog, GhostPopover, or menu, one Escape closes just the topmost open overlay: the tooltip closes first and a second Escape reaches the dialog. Tooltips never act as a modal or click-away layer: pressing outside still dismisses the dialog or popover beneath an open tooltip, and pressing the tooltip itself does not. Calling event.preventDefault() on Escape (or pressing it during IME composition) leaves every layer open.

Advanced: headless composition ​

Teams that bring their own design system can import the same parts from @ghostvue/vue. They keep the timing, positioning, and dismissal behavior and paint nothing, so each example brings its own consumer CSS for the label.

Basic use ​

Supplemental label Headless

Icon-only trigger with delay timing, floating placement, and aria-describedby.

The headless GhostTooltip owns open via useControllableState, assigns deterministic IDs via useGhostId, applies the open and close delays, positions the floating label with useFloating, renders it through GhostPortal by default, unmounts it with v-if when closed, and dismisses on Escape.

Headless skip delay ​

Provider skip delay Headless

Adjacent tooltips share skipDelayDuration under GhostTooltipProvider.

The same provider timing with unstyled toolbar buttons: hover Undo, wait for its tip, then move to Redo to see the delay skipped.

API ​

See the generated component references for props, emits, slots, exposed members, styling hooks, CSS variables, and executable examples.

PropTypeDefaultDescription
closeDelaynumber300Milliseconds before hiding after hover/focus ends (WCAG hoverable grace).
defaultOpenbooleanfalseInitial open state when open is omitted.
delayDurationnumber—Milliseconds before showing after hover or focus begins.
disableHoverableContentbooleanfalseWhen true, hides immediately on pointer/focus leave.
openboolean—Controlled open state. Omit for uncontrolled mode.
SlotSlot propsDescription
defaultopen: booleanTooltip trigger and content parts.

@ghostvue/themes adds no props, events, or slots to the headless GhostTooltip API, which it forwards.

GhostTooltip (root) ​

Supports delayDuration, closeDelay, and disableHoverableContent. Emits update:open with (open: boolean). The default slot receives { open: boolean }.

GhostTooltipTrigger ​

Sets type="button" (when as="button"), aria-describedby merging consumer ids with the tooltip id while open, data-part="trigger", and data-state="open" | "closed". Schedules show on pointerenter / focusin and hide on pointerleave / focusout when not disabled. Exposes { element, focus, blur }.

GhostTooltipContent ​

Keeps visibility: hidden until useFloating().isPositioned resolves. Sets role="tooltip", data-part="content", data-state="open", and data-placement. Must not contain focusable descendants. Exposes { element, focus, blur }.

Accessibility ​

  • Supplemental descriptions: aria-describedby links the trigger to tooltip text while open; tooltips must not be the only source of required information.
  • WCAG 1.4.13: closeDelay preserves a grace period before hiding; hoverable content keeps the tooltip open while the pointer is over the trigger, content, or while the trigger stays focused. Press Escape to dismiss immediately; inside a dialog or popover, the first Escape closes only the tooltip.
  • No focus theft: Opening does not move focus; tooltip content is not tabbable.

Specification ​

See GhostTooltip specification and ADR 0011.