Skip to content

Tooltip

A lightweight, high-performance tooltip component based on the industry-leading Floating UI positioning engine.

Basic Usage

Provides 12 placement directions through the `placement` prop.

Basic Usage

Theme

Two built-in themes: `light` and `dark`. Default is `dark`.

Theme Effect

Custom Theme

By setting `effect="customized"` and writing corresponding CSS, you can achieve terminal visual effects.

Custom Theme

Sizes and Styles

Supports custom width, max-height, and long content scrolling.

Sizes and Free Styles

Display HTML Content

The content property can be set as an HTML string, enabled by `raw-content`.

HTML Rendering

Trigger Behavior

Supports hover, click, focus, and contextmenu triggers. Default is `hover`.

Trigger Mode

Advanced Features

Follow Cursor

Follow Cursor

Interactive

Interactive

Use in Nuxt

YH-UI is perfectly compatible with Nuxt 3. You can use components directly without manual import.

Nuxt 3 Support

FAQ

How to allow space input in a nested Input?

When Tooltip contains an input box, in YH-UI, we ensure interaction logic doesn't interfere with normal input. You can nest it directly.

Nested Input Example

Use `content` slot. Ensure `interactive` is enabled.

Embed External link

API

Props

NameDescriptionTypeDefault
contentDisplay text`string`-
placementPositioning`TooltipPlacement``'top'`
triggerTrigger mode`TooltipTriggerTooltipTrigger[]`
disabledWhether disabled`boolean``false`
effectTheme style`string``'dark'`
offsetOffset [h, v]`[number, number]``[0, 8]`
show-afterShow delay (ms)`number``0`
hide-afterHide delay (ms)`number``200`
show-arrowWhether to show arrow`boolean``true`
interactiveAllow mouse enter popper`boolean``true`
visibleManual visibility`booleannull`
raw-contentRender HTML string`boolean``false`
follow-cursorFollow mouse cursor`boolean``false`
persistentPersistent DOM`boolean``true`
widthPopper width`stringnumber`
max-heightMax height`stringnumber`
scrollableScrollable content`boolean``false`
popper-classCustom popper class`string`-
popper-styleCustom popper style`object`-
content-classCustom content class`string`-
content-styleCustom content style`object`-
z-indexz-index`number``2000`
transitionTransition name`string``'yh-tooltip-fade'`
teleportedTeleport to body`boolean``true`

Slots

NameDescription
defaultTrigger element
contentCustom content (overrides content prop)

Events

NameDescriptionParameters
showTriggers when showing-
hideTriggers when hiding-
update:visibleVisibility change`(visible: boolean)`

CSS Variables

NameDescriptionDefault
`--yh-tooltip-bg`Background color`var(--yh-bg-color-overlay)`
`--yh-tooltip-border`Border color`var(--yh-border-color-light)`
`--yh-tooltip-text`Text color`var(--yh-text-color-primary)`
`--yh-z-index-tooltip`z-index`2004`

Dark Mode

Tooltip automatically switches to dark themes when `html.dark` is present.

Released under the MIT License.