Skip to content

Tooltip

The Tooltip component displays a short contextual help text when the user hovers over it. The component implements the W3C ARIA APG Tooltip Pattern.

Examples

Base

Position

The direction in which the tooltip opens can be defined by the position prop. By default, the direction is automatically calculated from the distance to the edge of the window. Adding the teleport prop additionally will move the tooltip to the referenced DOM location instead.

Triggers

The component accepts several different trigger variants, such as openOnClick or openOnContextmenu to only open on right click instead of left click. By default, only openOnHover is set. The action that close the component can also be customized using the closeable, closeOnOutside and closeOnEscape props.

Variants

Different styles can be achieved with the variant prop.

Multiline

Sometimes the tooltip label can be very long. Consider setting the multiline prop to force a line break.

Slot

The tooltip label can be customised using the content slot.

Tooltip Component

Display a brief helper text to your user.

html
<o-tooltip></o-tooltip>

Props

Prop nameDescriptionTypeValuesDefault
activeWhether tooltip is active or not, use v-model:active to make it two-way bindingboolean-false
alwaysTooltip will be always activeboolean-false
animationTooltip default animationstring-
From config:
tooltip: {
  animation: "fade"
}
closeOnEscapeClose when pressing escape keyboolean-
From config:
tooltip: {
  closeOnEscape: true
}
closeOnOutsideClose when clicked outside of the panelboolean-
From config:
tooltip: {
  closeOnOutside: true
}
closeable
deprecated - will be only boolean - use closeOnOutside and closeOnEscape instead
Tooltip auto close options (pressing escape, clicking the content or outside)
boolean | ("content" | "escape" | "outside")[]true, false, content, outside, escape
From config:
tooltip: {
  closeable: true
}
delayTooltip delay before it appears (number in ms)number-
disabledTooltip will be disabledboolean-false
labelTooltip text, unnecessary when content slot is usedstring-
multilineTooltip will be multilinedboolean-false
openOnClickShow when clicked on the triggerboolean-
From config:
tooltip: {
  openOnClick: false
}
openOnContextmenuShow when right clicked on the triggerboolean-
From config:
tooltip: {
  openOnContextmenu: false
}
openOnFocusShow when trigger get focusedboolean-
From config:
tooltip: {
  openOnFocus: true
}
openOnHoverShow when hover over the triggerboolean-
From config:
tooltip: {
  openOnHover: true
}
overrideOverride existing theme classes completelyboolean-
positionPosition of the Tooltip relative to the trigger"auto" | "bottom-left" | "bottom-right" | "bottom" | "left" | "right" | "top-left" | "top-right" | "top"auto, top, bottom, left, right, top-right, top-left, bottom-left, bottom-right
From config:
tooltip: {
  position: "auto"
}
teleportAppend the component to another part of the DOM.
Set true to append the component to the body.
In addition, any CSS selector string or an actual DOM node can be used.
boolean | object | string-
From config:
dropdown: {
  teleport: false
}
triggerTagTooltip trigger tag nameDynamicComponent-
From config:
tooltip: {
  triggerTag: "div"
}
triggers
deprecated - will be removed - use triggerOnClick, triggerOnHover, triggerOnContextmenu and `triggerOnFocus, instead
Tooltip trigger events
("focus" | "click" | "contextmenu" | "hover")[]hover, click, focus, contextmenu
From config:
tooltip: {
  triggers: []
}
variantColor of the tooltipstringprimary, info, success, warning, danger, and any other custom color
From config:
tooltip: {
  variant: undefined
}

Events

Event namePropertiesDescription
update:activevalue boolean - updated active propactive prop two-way binding
closeevent Event - native eventon active state changes to false
openevent Event - native eventon active state changes to true

Slots

NameDescriptionBindings
defaultTooltip trigger slotactive boolean - tooltip active state
contentTooltip content, default is label prop

Class Inspector

Classes applied to the element:
Want to know how does the Class Inspector work?
Class propDescriptionPropsSuffixes
rootClass
Class of the root element.
teleportClass
Class of the root element when teleported.
teleport
triggerClass
Class of the trigger element.
contentClass
Class of the content element.
positionClass
Class of the content element with position.
positiontop
bottom
left
right
variantClass
Class of the content element with variant.
variantprimary
info
warning
danger
multilineClass
Class of the content element when is multiline.
multiline
alwaysClass
Class of the content element when is always visible.
always
arrowClass
Class of the arrow element.
arrowPositionClass
Class of the arrow element with position.
positiontop
bottom
left
right
arrowVariantClass
Class of the arrow element with variant.
variantprimary
info
warning
danger

Sass Variables

Current theme ➜ Oruga

SASS VariableDefault
$tooltip-zindexmap.get(vars.$zindex, "tooltip")
$tooltip-content-font-size0.85rem
$tooltip-content-colorh.useVar("white")
$tooltip-content-font-weighth.useVar("font-weight")
$tooltip-content-line-heighth.useVar("line-height")
$tooltip-content-padding0.35em 0.75em
$tooltip-content-multiline-width300px
$tooltip-content-box-shadowh.useVar("overlay-box-shadow")
$tooltip-content-background-colorh.useVar("grey-darkest")
$tooltip-content-border-radiush.useVar("border-radius")
$tooltip-arrow-margin2px
$tooltip-arrow-size5px

See ➜ 📄 SCSS file

Current theme ➜ Bulma

SASS VariableDefault
$tooltip-arrow-size5px
$tooltip-arrow-margin2px
$tooltip-content-multiline-width300px
$tooltip-shadow0 1px 2px 1px rgba(0, 1, 0, 0.2)
$tooltip-z38
$tooltip-colorsdv.$colors
$tooltip-border-radiuscss.getVar("radius")
$tooltip-bgcss.getVar("scheme-main-bis")
$tooltip-colorcss.getVar("text-body")

See ➜ 📄 SCSS file

Current theme ➜ Bootstrap

SASS VariableDefault
$tooltip-arrow-spacer2px
$tooltip-content-multiline-width50vw
$tooltip-shadow$box-shadow-sm
$tooltip-zindex$zindex-tooltip

See ➜ 📄 SCSS file

Released under the MIT License.