Skip to content

Tooltip

FTTooltip is a flexible and customizable tooltip component for Vue 3, built on top of vue3-popper. It provides advanced positioning, theming, and interaction options for tooltips and popovers.

Usage

INFO

vue
<template>
  <FTTooltip content="Hello!" placement="bottom">
    <button>Hover me</button>
  </FTTooltip>

  <FTTooltip :hover="true" theme="light">
    <template #content>
      <div style="color: #333">Custom <b>HTML</b> content</div>
    </template>
    <span>Hover for custom slot</span>
  </FTTooltip>
</template>
<template>
  <FTTooltip content="Hello!" placement="bottom">
    <button>Hover me</button>
  </FTTooltip>

  <FTTooltip :hover="true" theme="light">
    <template #content>
      <div style="color: #333">Custom <b>HTML</b> content</div>
    </template>
    <span>Hover for custom slot</span>
  </FTTooltip>
</template>

Props

PropTypeDefaultDescription
themestring'dark'Tooltip theme: 'dark' or 'light'.
placementstring'top'Popper.js placement (e.g. 'top', 'bottom-end', etc.).
disableClickAwaybooleanfalseIf true, disables closing tooltip on outside click.
offsetSkidstring'0'Horizontal offset (skid) in px.
offsetDistancestring'12'Vertical offset (distance) in px.
hoverbooleanfalseIf true, opens on hover.
arrowbooleanfalseShow arrow on tooltip.
arrowPaddingstring'0'Padding for the arrow.
disabledbooleanfalseDisable the tooltip.
openDelaystring'0'Delay before opening (ms).
closeDelaystring'0'Delay before closing (ms).
interactivebooleantrueIf true, tooltip content is interactive.
contentstringundefinedContent for the tooltip (can also use slot).
showbooleanundefinedControl visibility programmatically.
lockedbooleanfalseIf true, tooltip cannot be closed.
zIndexstring'9999'z-index for the tooltip popper.

Events

EventDescription
open:popperEmitted when the tooltip is opened.
close:popperEmitted when the tooltip is closed.

Slots

  • default: The element that triggers the tooltip.
  • content: Custom tooltip content (overrides content prop).

Styling

The component uses CSS variables for theming. You can override them in your global styles or use the .light/.dark classes for custom themes.

Dependencies