Overlays

Tooltip

Brief and informative text that appears when an element is hovered or focused.

Usage

Content

Wrap the element the tooltip explains, and pass the text in the content prop. The tooltip opens 150ms after the pointer enters the element, and at once when the element gets the focus from the keyboard.

<KTooltip content="Downloads every transaction from the selected period as a CSV file.">
  <KButton label="Export" variant="outline" color="gray" :leading-icon="Download" />
</KTooltip>

The tooltip adds no element around yours: it listens on your element directly, and points screen readers to its text with aria-describedby while it is open. Other attributes given to KTooltip, like data-testid, go to your element too.

Your element must be able to receive the focus, so keyboard users can open the tooltip. Buttons, links and fields already do. Give tabindex="0" to anything else, like an icon or a badge.

Text trigger

Use the label prop to explain a few words in a sentence. They get a dotted underline while the tooltip is open, and can be reached with Tab.

Your available balance is updated every hour.
<p>
  Your
  <KTooltip label="available balance" content="Includes pending transactions that have not cleared yet." />
  is updated every hour.
</p>

Compact

Set compact for a short label of one to three words, like the name of an icon button. Compact tooltips use inverted colors.

<KTooltip content="Copy account number" compact>
  <KButton label="Copy account number" variant="ghost" color="gray" :leading-icon="Copy" square />
</KTooltip>
<KTooltip content="Download statement" compact>
  <KButton label="Download statement" variant="ghost" color="gray" :leading-icon="FileDown" square />
</KTooltip>

Side

Use the side prop to open the tooltip top (default), right, bottom or left of its element, and side-offset to change the 5px gap between them.

<KTooltip content="Opens top" compact>
  <KButton label="Top" variant="outline" color="gray" />
</KTooltip>
<KTooltip content="Opens right" side="right" compact>
  <KButton label="Right" variant="outline" color="gray" />
</KTooltip>

When there is not enough room on its side, the tooltip opens on the other side. It also slides along its element to stay 15px away from the edges of the screen.

Align

Use the align prop to line the tooltip up with the start, the center (default) or the end of its element, and align-offset to move it away from that start or end.

<KTooltip content="Balances are refreshed every 15 minutes." align="start">
  <KButton label="Start" variant="outline" color="gray" />
</KTooltip>

Gutter size

Use the gutter-size prop to change the space inside the tooltip: sm, md (default) or lg. Compact tooltips keep their own tight space.

Small Medium Large
<KTooltip label="Small" gutter-size="sm" content="Refreshed every 15 minutes" />
<KTooltip label="Medium" content="Refreshed every 15 minutes" />
<KTooltip label="Large" gutter-size="lg" content="Refreshed every 15 minutes" />

Max width

Long text wraps at 300px. Use the max-width prop to change it, in pixels, or set it to none to keep the text on one line.

300px 200px One line
<KTooltip label="300px" content="Transfers made after 6 PM arrive on the next business day." />
<KTooltip label="200px" :max-width="200" content="Transfers made after 6 PM arrive on the next business day." />
<KTooltip label="One line" max-width="none" content="Transfers made after 6 PM arrive on the next business day." />

Open delay

Use the open-delay prop to change how long the pointer must stay on the element before the tooltip opens, in milliseconds. When the pointer comes back within 300ms of the tooltip closing, it opens again without waiting.

<KTooltip content="Balances are refreshed every 15 minutes." :open-delay="600">
  <KButton label="Refresh balances" variant="outline" color="gray" />
</KTooltip>

Content slot

Use the content slot to put more than plain text in the tooltip.

Your available balance is updated every hour.

<KTooltip label="available balance">
  <template #content>
    <span class="block font-medium">$4,280.15 available</span>
    <span class="block text-muted">$312.40 is still pending and has not cleared yet.</span>
  </template>
</KTooltip>

Interactive

By default, the tooltip closes as soon as the pointer leaves its element. Set interactive when the tooltip holds something to click, like a link: it then stays open while the pointer travels from the element to the tooltip, and closes once the pointer strays from that path.

<KTooltip interactive side="bottom">
  <KButton label="Fees" variant="soft" color="gray" />
  <template #content>
    Transfers between your accounts are free.
    <KTextLink label="See pricing" href="/pricing" />
  </template>
</KTooltip>

Conditional tooltip

A tooltip without content never opens. Pass undefined to show it only in some cases, like explaining why a button is disabled.

<KTooltip :content="isSyncing ? 'Exports are paused while your accounts are syncing.' : undefined">
  <KButton label="Export" :leading-icon="Download" :disabled="isSyncing" />
</KTooltip>

Clicks right after opening

Pressing or clicking the element closes the tooltip. Set prevent-unintentional-click-to-close to keep it open when the click comes within 400ms of the tooltip opening, which is often a click the user had already started.

<KTooltip content="Balances are refreshed every 15 minutes." prevent-unintentional-click-to-close>
  <KButton label="Refresh balances" variant="outline" color="gray" />
</KTooltip>

Open state

Use v-model:open to know whether the tooltip is open, or to open and close it from your code.

The tooltip is closed.

<script setup lang="ts">
import { ref } from 'vue'

const isTooltipOpen = ref(false)
</script>

<template>
  <KTooltip v-model:open="isTooltipOpen" content="Balances are refreshed every 15 minutes.">
    <KButton label="Refresh balances" variant="outline" color="gray" />
  </KTooltip>
  <p>The tooltip is {{ isTooltipOpen ? 'open' : 'closed' }}.</p>
</template>

Behavior

The tooltip closes when:

  • the pointer leaves its element, unless the tooltip is interactive;
  • the element is pressed, clicked or loses the focus;
  • Esc is pressed;
  • a pointer goes down anywhere else;
  • the page, or an area around the element, scrolls;
  • another tooltip opens, since only one is shown at a time.

It does not open on touch screens, where there is no hover.

Keyboard

KeyAction
TabFocusing the element opens the tooltip at once, and leaving it closes the tooltip.
EscCloses the tooltip.

Customization

Use the ui prop to change the classes of the tooltip (base) and of the text trigger made by label (trigger), and class for the tooltip. Your classes always win: rounded-2xl replaces the default rounded-lg instead of being added to it.

Rounder
<KTooltip label="Rounder" content="Balances are refreshed every 15 minutes." :ui="{ base: 'rounded-2xl' }" />

API

Props

PropTypeDefault
contentstring
labelstring
openbooleanfalse
side'top' | 'right' | 'bottom' | 'left''top'
align'start' | 'center' | 'end''center'
sideOffsetnumber5
alignOffsetnumber0
maxWidthnumber | 'none'300
gutterSize'sm' | 'md' | 'lg''md'
compactbooleanfalse
openDelaynumber150
interactivebooleanfalse
preventUnintentionalClickToClosebooleanfalse
ui{ base?, trigger? }
classstring

Slots

SlotDescription
defaultThe element the tooltip explains. Plain text gets the same dotted underline as label.
contentReplaces the content prop.

Emits

EventPayload
update:openboolean
Copyright © 2026