Skip to content

Tooltip API Reference

Props

PropTypeDefaultDescription
contentString''The tooltip text content
positionString'top'Position of the tooltip relative to trigger element
triggerString'hover'How the tooltip is triggered
showArrowBooleantrueWhether to show the arrow indicator
offsetNumber8Distance between tooltip and trigger element
delayNumber300Delay before showing tooltip (ms)
hideDelayNumber100Delay before hiding tooltip (ms)
customClassString''Additional CSS classes for the tooltip
disabledBooleanfalseWhether the tooltip is disabled

Position Options

The position prop accepts the following values:

  • 'top' - Above the trigger element
  • 'bottom' - Below the trigger element
  • 'left' - To the left of the trigger element
  • 'right' - To the right of the trigger element
  • 'top-left' - Above and aligned to the left
  • 'top-right' - Above and aligned to the right
  • 'bottom-left' - Below and aligned to the left
  • 'bottom-right' - Below and aligned to the right

Trigger Options

The trigger prop accepts the following values:

  • 'hover' - Show on mouse enter, hide on mouse leave
  • 'click' - Toggle on click, hide on click outside
  • 'focus' - Show on focus, hide on blur

Events

EventPayloadDescription
show-Emitted when the tooltip becomes visible
hide-Emitted when the tooltip becomes hidden
togglebooleanEmitted when the tooltip visibility changes

Slots

SlotPropsDescription
default-The trigger element that activates the tooltip
tooltip-Custom content for the tooltip (overrides content prop)

Methods

The component exposes the following methods via template refs:

MethodDescription
show()Programmatically show the tooltip
hide()Programmatically hide the tooltip
toggle()Toggle the tooltip visibility
isVisibleComputed property indicating if tooltip is visible

Dependencies

This component depends on:

  • Vue 3 with Composition API
  • Vue Teleport for positioning
  • Vue Transition for animations