Components
A popup that reveals information when hovering over an element.

Usage

Use a Button or any other component in the default slot of the Tooltip.

Make sure to wrap your app with the App component which uses the TooltipProvider component from Radix Vue.
You can check the App component tooltip prop to see how to configure the Tooltip globally.

Text

Use the text prop to set the content of the Tooltip.

<template>
  <UTooltip text="Open on GitHub">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>

Kbds

Use the kbds prop to render Kbd components in the Tooltip.

<template>
  <UTooltip text="Open on GitHub" :kbds="['meta', 'G']">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>
You can use special keys like meta that displays as on macOS and Ctrl on other platforms.

Delay

Use the delay-duration prop to change the delay before the Tooltip appears. For example, you can make it appear instantly by setting it to 0.

<template>
  <UTooltip :delay-duration="0" text="Open on GitHub">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>
This can be configured globally through the tooltip.delayDuration option in the App component.

Content

Use the content prop to control how the Tooltip content is rendered, like its align or side for example.

<template>
  <UTooltip
    :content="{
      align: 'center',
      side: 'bottom',
      sideOffset: 8
    }"
    text="Open on GitHub"
  >
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>

Arrow

Use the arrow prop to display an arrow on the Tooltip.

<template>
  <UTooltip arrow text="Open on GitHub">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>

Disabled

Use the disabled prop to disable the Tooltip.

<template>
  <UTooltip disabled text="Open on GitHub">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>

Examples

Control open state

You can control the open state by using the default-open prop or the v-model:open directive.

<script setup lang="ts">
const open = ref(false)

defineShortcuts({
  o: () => open.value = !open.value
})
</script>

<template>
  <UTooltip v-model:open="open" text="Open on GitHub">
    <UButton label="Open" color="gray" variant="subtle" />
  </UTooltip>
</template>
In this example, press O to toggle the Tooltip.

API

Props

Prop Default Type
text

string

The text content of the tooltip.

kbds

(string | undefined)[] | KbdProps[]

The keyboard keys to display in the tooltip.

content

{ side: 'bottom', sideOffset: 8 }

Omit<TooltipContentProps, "asChild" | "as">

The content of the tooltip.

arrow

false

boolean | Omit<TooltipArrowProps, "asChild" | "as">

Display an arrow alongside the tooltip.

portal

true

boolean

Render the tooltip in a portal.

defaultOpen

boolean

The open state of the tooltip when it is initially rendered. Use when you do not need to control its open state.

open

boolean

The controlled open state of the tooltip.

delayDuration

700

number

Override the duration given to the Provider to customise the open delay for a specific tooltip.

disableHoverableContent

boolean

Prevents Tooltip.Content from remaining open when hovering. Disabling this has accessibility consequences. Inherits from Tooltip.Provider.

disableClosingTrigger

false

boolean

When true, clicking on trigger will not close the content.

disabled

false

boolean

When true, disable tooltip

ignoreNonKeyboardFocus

false

boolean

Prevent the tooltip from opening if the focus did not come from the keyboard by matching against the :focus-visible selector. This is useful if you want to avoid opening it when switching browser tabs or closing a dialog.

ui

Partial<{ content: string; arrow: string; text: string; kbds: string; kbdsSize: string; }>

Slots

Slot Type
default

{ open: boolean; }

content

{}

Emits

Event Type
update:open

[value: boolean]

Theme

app.config.ts
export default defineAppConfig({
  ui: {
    tooltip: {
      slots: {
        content: 'flex items-center gap-1 bg-white dark:bg-gray-900 text-gray-900 dark:text-white shadow rounded ring ring-gray-200 dark:ring-gray-800 h-6 px-2 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]',
        arrow: 'fill-gray-200 dark:fill-gray-800',
        text: 'truncate',
        kbds: "hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['·'] before:mr-0.5",
        kbdsSize: 'sm'
      }
    }
  }
})