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 action to trigger the tooltip can be customized using the triggers prop. The action that closes the tooltip can be customized using the closaeble prop.

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"
}
closeableTooltip auto close options (pressing escape, clicking the content or outside)boolean | ("content" | "escape" | "outside")[]true, false, content, outside, escape
From config:
tooltip: {
  closeable: ["escape","outside","content"]
}
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
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"
}
triggersTooltip trigger events("click" | "contextmenu" | "focus" | "hover")[]hover, click, focus, contextmenu
From config:
tooltip: {
  triggers: ["hover","focus"]
}
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
closeon active change to false event
openon active change to true event

Slots

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

Class Inspector

Classes applied to the element:
Class propDescriptionPropsSuffixes
rootClassClass of the root element.
teleportClassClass of the root element when teleported.teleport
triggerClassClass of the trigger element.
contentClassClass of the content element.
positionClassClass of the content element with position.positiontop
bottom
left
right
variantClassClass of the content element with variant.variantprimary
info
warning
danger
multilineClassClass of the content element when is multiline.multiline
alwaysClassClass of the content element when is always visible.always
arrowClassClass of the arrow element.
arrowPositionClassClass of the arrow element with position.positiontop
bottom
left
right
arrowVariantClassClass of the arrow element with variant.variantprimary
info
warning
danger

Sass variables

Current theme ➜ Oruga

SASS VariableDefault
$tooltip-arrow-margin2px
$tooltip-arrow-size5px
$tooltip-background-colorvar(--#{$prefix}primary)
$tooltip-colorvar(--#{$prefix}primary-invert)
$tooltip-content-box-shadow0px 1px 2px 1px rgba(0, 1, 0, 0.2)
$tooltip-content-font-size0.85rem
$tooltip-content-max-width300px
$tooltip-content-multiline-width300px
$tooltip-content-padding0.35rem 0.75rem
$tooltip-content-radius-large6px
$tooltip-content-weight-normal400
$tooltip-content-zindex38

See ➜ 📄 Full 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 ➜ 📄 Full scss file

Current theme ➜ Bootstrap

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

See ➜ 📄 Full scss file

Released under the MIT License.