Skip to content

Tooltip

Tooltips display brief explanatory text on hover, helping users understand UI element functionality.

Basic Usage

Hover over the trigger element to show the tooltip. Default placement is top.

vue

<TTooltip text="This is a tooltip">
  <button class="btn">Hover me</button>
</TTooltip>

Four Directions

Four placement options: top (default), right, bottom, and left.

Show Code
vue

<TTooltip placement="left" text="Left tooltip">
  <button class="btn">Left</button>
</TTooltip>
<TTooltip placement="top" text="Top tooltip">
  <button class="btn">Top</button>
</TTooltip>
<TTooltip placement="bottom" text="Bottom tooltip">
  <button class="btn">Bottom</button>
</TTooltip>
<TTooltip placement="right" text="Right tooltip">
  <button class="btn">Right</button>
</TTooltip>

Icon Elements

The default slot accepts any element — works great with icons.

Show Code
vue

<script setup>
import { IconInfoCircle } from '@tabler/icons-vue'
</script>

<template>
  <TTooltip text="Useful information here">
    <span class="d-inline-flex align-items-center gap-1 text-secondary">
      <IconInfoCircle size="20" />
      Hover for info
    </span>
  </TTooltip>
</template>

Disabled State

Set the disabled prop to disable the tooltip interaction.

vue

<TTooltip disabled text="Disabled tooltip">
  <button class="btn btn-secondary">Disabled</button>
</TTooltip>

Long Text

Tooltip has a max-width of 200px by default. Text wraps automatically.

vue

<TTooltip text="This is a longer tooltip text that demonstrates automatic text wrapping and the max-width limit.">
  <button class="btn btn-outline-warning">Hover for long text</button>
</TTooltip>

API

Props

PropTypeDefaultDescription
textstring''Tooltip text content
placement'top' | 'right' | 'bottom' | 'left''top'Tooltip placement direction
disabledbooleanfalseWhether to disable the tooltip
showDelaynumber100Delay before showing on hover (ms)
hideDelaynumber150Delay before hiding on mouse leave (ms)

Slots

SlotDescription
defaultTrigger element (button, icon, text, etc.)

Emits

EventPayloadDescription
openEmitted when tooltip opens
closeEmitted when tooltip closes