v1.3.0 28

Tooltip

A popup that displays information related to an element when the element receives hover focus.

Default

Hover over the buttons to see tooltips.

html
Add to library
Add new item
<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered">
    Hover me
  </button>
  <div class="vt-tooltip">
    Add to library
  </div>
</div>
<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered vt-btn-icon" aria-label="Add new item">

    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
      <path d="M11.9922 4.00012V20.0001M19.9922 12.0001H3.99222" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
    </svg>
  </button>
  <div class="vt-tooltip">
    Add new item
  </div>
</div>

Positions

Tooltip placement on all four sides.

html
Tooltip on top
Tooltip on bottom
Tooltip on left
Tooltip on right
<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered">
    Top
  </button>
  <div class="vt-tooltip">
    Tooltip on top
  </div>
</div>

<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered">
    Bottom
  </button>
  <div class="vt-tooltip vt-tooltip-bottom">
    Tooltip on bottom
  </div>
</div>

<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered">
    Left
  </button>
  <div class="vt-tooltip vt-tooltip-left">
    Tooltip on left
  </div>
</div>

<div class="vt-tooltip-wrap">
  <button class="vt-btn vt-btn-bordered">
    Right
  </button>
  <div class="vt-tooltip vt-tooltip-right">
    Tooltip on right
  </div>
</div>

Toolbar with Tooltips

Icon buttons with tooltip labels.

html
Edit
Copy
Align
Settings
<div class="vt-toolbar">
  <div class="vt-tooltip-wrap">
    <button type="button" class="vt-toolbar-btn" aria-label="Edit">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M6 22V13.6944C6 12.1287 6 11.3459 6.21454 10.6077C6.42908 9.86948 6.84589 9.21812 7.6795 7.91542L10.3359 3.76419C11.0885 2.58806 11.4648 2 12 2C12.5352 2 12.9115 2.58806 13.6641 3.76419L16.3205 7.91542C17.1541 9.21812 17.5709 9.86948 17.7855 10.6077C18 11.3459 18 12.1287 18 13.6944V22" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M7 11C7.63152 11.3231 8.4887 11.9732 9.28009 11.9991C10.2988 12.0324 10.9868 11.1372 12 11.1372C13.0132 11.1372 13.7012 12.0324 14.7199 11.9991C15.5113 11.9732 16.3685 11.3231 17 11" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M12 12L12 22" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M10 5H14" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
    <div class="vt-tooltip">Edit</div>
  </div>
  <div class="vt-tooltip-wrap">
    <button type="button" class="vt-toolbar-btn" aria-label="Copy">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M7 11V9C7 5.70017 7 4.05025 8.02513 3.02513C9.05025 2 10.7002 2 14 2C17.2998 2 18.9497 2 19.9749 3.02513C21 4.05025 21 5.70017 21 9V11C21 14.2998 21 15.9497 19.9749 16.9749C18.9497 18 17.2998 18 14 18C10.7002 18 9.05025 18 8.02513 16.9749C7 15.9497 7 14.2998 7 11Z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M3 6V15C3 18.2998 3 19.9497 4.02513 20.9749C5.05025 22 6.70017 22 10 22H17" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
    <div class="vt-tooltip">Copy</div>
  </div>
  <div class="vt-separator vt-separator-v"></div>
  <div class="vt-tooltip-wrap">
    <button type="button" class="vt-toolbar-btn" aria-label="Align">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M3 3H21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M3 9H21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M3 15H21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path><path d="M3 21H21" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"></path>
      </svg>
    </button>
    <div class="vt-tooltip">Align</div>
  </div>
  <div class="vt-tooltip-wrap">
    <button type="button" class="vt-toolbar-btn" aria-label="Settings">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill="none" class="vt-w-4 vt-h-4" aria-hidden="true">
        <path d="M3.95631 10.5829L3.03254 9.07084C2.74505 8.60024 2.7389 8.00978 3.01652 7.5333L3.63533 6.47124C3.90953 6.00064 4.41721 5.71571 4.96162 5.7269L6.69131 5.76245C6.92616 5.76728 7.15379 5.68727 7.34333 5.54846C7.79531 5.21745 8.28334 4.93276 8.80042 4.70139C9.01191 4.60675 9.19222 4.45165 9.30469 4.24903L10.1203 2.77965C10.3847 2.30328 10.8865 2.00781 11.4312 2.00781H12.6937C13.2384 2.00781 13.7403 2.30329 14.0047 2.77966L14.8202 4.24902C14.9327 4.45165 15.113 4.60675 15.3245 4.70139C15.8416 4.93274 16.3296 5.2174 16.7815 5.54838C16.9711 5.68718 17.1987 5.76718 17.4336 5.76235L19.1634 5.72676C19.7078 5.71557 20.2155 6.00049 20.4897 6.47111L21.1085 7.53314C21.3862 8.00963 21.38 8.60009 21.0925 9.07068L20.1687 10.5828C20.0481 10.7803 20.002 11.0134 20.0235 11.2439C20.0707 11.7486 20.0707 12.267 20.0235 12.7717C20.002 13.0022 20.0481 13.2353 20.1687 13.4329L21.0924 14.9448C21.3799 15.4154 21.3861 16.0058 21.1084 16.4823L20.4896 17.5444C20.2154 18.015 19.7077 18.2999 19.1633 18.2887L17.4338 18.2531C17.1989 18.2483 16.9713 18.3283 16.7817 18.4671C16.3297 18.7982 15.8416 19.0829 15.3245 19.3142C15.113 19.4089 14.9327 19.564 14.8202 19.7666L14.0047 21.236C13.7403 21.7123 13.2384 22.0078 12.6937 22.0078H11.4312C10.8866 22.0078 10.3847 21.7123 10.1203 21.236L9.30468 19.7665C9.19222 19.5639 9.01191 19.4088 8.80042 19.3142C8.28329 19.0828 7.79519 18.798 7.34316 18.467C7.15362 18.3282 6.92597 18.2482 6.69111 18.253L4.96175 18.2886C4.41733 18.2998 3.90963 18.0148 3.63543 17.5442L3.01663 16.4822C2.739 16.0057 2.74515 15.4152 3.03264 14.9446L3.95631 13.4327C4.07699 13.2351 4.12309 13.002 4.10154 12.7715C4.05437 12.267 4.05438 11.7486 4.10154 11.244C4.12308 11.0135 4.07699 10.7805 3.95631 10.5829Z" stroke="currentColor" stroke-width="1.5"></path><circle cx="12.0625" cy="12.0078" r="3.5" stroke="currentColor" stroke-width="1.5"></circle>
      </svg>
    </button>
    <div class="vt-tooltip">Settings</div>
  </div>
</div>

Guidelines

Add item
Do Label icon-only controls with a short tooltip hint (hover the button).
This permanently deletes your account and all of its data — this action cannot be undone.
Don't Don't bury long or critical content inside a tooltip.

API Reference

Class Type Description
vt-tooltip-wrap Base Wrapper for trigger and tooltip — adds position:relative and hover reveal
vt-tooltip Base Tooltip element — positioned above trigger by default, centered
vt-tooltip-bottom Position Bottom placement — centered below trigger
vt-tooltip-left Position Left placement — centered to the left
vt-tooltip-right Position Right placement — centered to the right
vt-open State Keeps the tooltip shown without hover — for a script that opens it, or a static picture
vt-bg-danger-fill Variant Red tooltip for destructive action hints
--vt-tooltip-bg Custom property Color of the bubble and its arrow — the arrow points at the trigger in every placement

Accessibility

Feature Details
Role Use role="tooltip" on the tooltip content element
Association Trigger element has aria-describedby pointing to tooltip id
Keyboard Tooltip shows on focus and hides on Escape
Hover Include delay before showing/hiding to prevent flickering
Content Keep tooltip text concise — for complex content use a popover instead