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 demo

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

Examples

Basic

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

<template>
  <GkTooltip text="Saved to your profile">
    <template #activator="{ props }">
      <GkButton type="button" v-bind="props">Hover me</GkButton>
    </template>
  </GkTooltip>
</template>

Advanced

vue
<GkTooltip placement="end" :show-delay="200" interactive>
  <!-- activator + custom tooltip content -->
</GkTooltip>

Edge case

vue
<GkTooltip
  v-model="open"
  persistent
  :open-on-hover="false"
  open-on-focus
/>

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.