Skip to content

GkTooltip

A teleported tooltip (default body): v-model visibility, #activator slot with props / is-open, aria-describedby on the activator when open, role="tooltip" on the panel, fixed top / left from useTooltipPosition, Escape and outside mousedown dismiss (unless persistent), optional interactive hover bridge, and text or default slot content.

This is intentionally smaller than Vuetify’s VTooltip: no VOverlay stack, locationStrategy / scrollStrategy beyond anchor + viewport clamping, or transition prop (built-in gk-tooltip transition only).

When to use

Use for short supplemental hints attached to an existing control. Keep content brief and avoid placing essential workflow information only in tooltips.

Live Examples

Hover and focus

Default tooltips open on hover and focus.

Best practice: Always bind activator props so aria-describedby and keyboard triggers stay connected.

Placement

Choose an edge relative to the activator.

Best practice: Keep tooltips close to the control they describe and prefer short text.

Interactive tooltip

Interactive mode lets the pointer enter the tooltip panel.

Best practice: Use interactive only when the tooltip has content users must hover into; otherwise keep tooltips passive.

Open on click

Use click-triggered tooltips for touch-friendly hints.

Best practice: For essential workflow content, prefer a menu, popover, or dialog over a tooltip.

API

Props

PropTypeDefaultDescription
modelValuebooleanfalseOpen state; use v-model
idstringautoid on the tooltip panel (for aria-describedby)
textstringDefault slot fallback when the default slot is empty
placement'top' | 'bottom' | 'start' | 'end''bottom'Edge relative to the activator (start / end are LTR-oriented)
offsetnumber10Gap between activator and panel (px)
openOnHoverbooleantrueOpen on pointer enter
openOnClickbooleanfalseToggle on activator click
openOnFocusbooleantrueOpen on focus (keyboard / screen reader)
interactivebooleanfalsePanel receives pointer events; hover can move activator → panel without closing
showDelaynumber0Delay before open (ms)
hideDelaynumber0Delay before close from non-interactive leave / focus (ms)
disabledbooleanfalseDisables all open triggers
persistentbooleanfalseOutside mousedown and Escape do not close
tostring | HTMLElement'body'Teleport target
zIndexnumber | string--gk-tooltip-z-indexLayer stacking
activatorPropsRecord<string, unknown>Merged with internal activator bindings

Additional attributes are applied to the tooltip panel (not the activator).

Slots

SlotSlot propsDescription
activatorprops, is-openBind v-bind="props" on the focusable control.
defaultTooltip content; falls back to text.

Events

EventPayloadDescription
update:modelValuebooleanOpen state
afterEnterTransition finished entering
afterLeaveTransition finished leaving

Composable

useTooltipPosition is exported from god-kit/vue for custom fixed tooltips; GkTooltipPlacement is the placement union type.

Tokens

TokenPurpose
--gk-tooltip-z-indexLayer stacking (2200)
--gk-tooltip-max-widthPanel max-width
--gk-tooltip-padding-x / --gk-tooltip-padding-yPanel padding
--gk-tooltip-shadowPanel shadow

Try It

Change tooltip placement and trigger options, preview the result, and copy generated Vue code.

vue
<script setup lang="ts">
import { GkButton, GkTooltip } from 'god-kit/vue'
</script>

<template>
  <GkTooltip
    text="Short help text."
    placement="bottom"
  >
    <template #activator="{ props }">
      <GkButton type="button" v-bind="props">Help</GkButton>
    </template>
  </GkTooltip>
</template>

Accessibility notes

  • Use v-bind=\"props\" from the activator slot so described-by and trigger handlers remain intact.
  • Prefer focus-enabled tooltips for keyboard users; hover-only hints are insufficient.
  • Keep tooltip text concise and non-interactive unless interactive is explicitly required.

Out of scope (v1)

VOverlay parity, scrollStrategy / locationStrategy beyond useTooltipPosition, custom transition name prop, and RTL-aware start / end flipping (use direction on a wrapper or app root for RTL).

Released under the MIT License.