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.
<o-tooltip></o-tooltip>
Props
Prop name | Description | Type | Values | Default |
---|---|---|---|---|
active | Whether tooltip is active or not, use v-model:active to make it two-way binding | boolean | - | false |
always | Tooltip will be always active | boolean | - | false |
animation | Tooltip default animation | string | - | From config: tooltip: { |
closeable | Tooltip auto close options (pressing escape, clicking the content or outside) | boolean | ("content" | "escape" | "outside")[] | true , false , content , outside , escape | From config: tooltip: { |
delay | Tooltip delay before it appears (number in ms) | number | - | |
disabled | Tooltip will be disabled | boolean | - | false |
label | Tooltip text, unnecessary when content slot is used | string | - | |
multiline | Tooltip will be multilined | boolean | - | false |
override | Override existing theme classes completely | boolean | - | |
position | Position 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: { |
teleport | Append 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: { |
triggerTag | Tooltip trigger tag name | DynamicComponent | - | From config: tooltip: { |
triggers | Tooltip trigger events | ("click" | "contextmenu" | "focus" | "hover")[] | hover , click , focus , contextmenu | From config: tooltip: { |
variant | Color of the tooltip | string | primary , info , success , warning , danger , and any other custom color | From config: tooltip: { |
Events
Event name | Properties | Description |
---|---|---|
update:active | value boolean - updated active prop | active prop two-way binding |
close | on active change to false event | |
open | on active change to true event |
Slots
Name | Description | Bindings |
---|---|---|
default | Tooltip trigger slot | active boolean - tooltip active state |
content | Tooltip content, default is label prop |
Class Inspector
Class prop | Description | Props | Suffixes | |
---|---|---|---|---|
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. | position | top | |
variantClass | Class of the content element with variant. | variant | primary | |
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. | position | top | |
arrowVariantClass | Class of the arrow element with variant. | variant | primary |
Sass variables
Current theme ➜ Oruga
SASS Variable | Default |
---|---|
$tooltip-arrow-margin | 2px |
$tooltip-arrow-size | 5px |
$tooltip-background-color | var(--#{$prefix}primary) |
$tooltip-color | var(--#{$prefix}primary-invert) |
$tooltip-content-box-shadow | 0px 1px 2px 1px rgba(0, 1, 0, 0.2) |
$tooltip-content-font-size | 0.85rem |
$tooltip-content-max-width | 300px |
$tooltip-content-multiline-width | 300px |
$tooltip-content-padding | 0.35rem 0.75rem |
$tooltip-content-radius-large | 6px |
$tooltip-content-weight-normal | 400 |
$tooltip-content-zindex | 38 |
See ➜ 📄 Full scss file
Current theme ➜ Bulma
SASS Variable | Default |
---|---|
$tooltip-arrow-size | 5px |
$tooltip-arrow-margin | 2px |
$tooltip-content-multiline-width | 300px |
$tooltip-shadow | 0 1px 2px 1px rgba(0, 1, 0, 0.2) |
$tooltip-z | 38 |
$tooltip-colors | dv.$colors |
$tooltip-border-radius | css.getVar("radius") |
$tooltip-bg | css.getVar("scheme-main-bis") |
$tooltip-color | css.getVar("text-body") |
See ➜ 📄 Full scss file
Current theme ➜ Bootstrap
SASS Variable | Default |
---|---|
$tooltip-arrow-spacer | 2px |
$tooltip-content-multiline-width | 50vw |
$tooltip-shadow | $box-shadow-sm |
$tooltip-zindex | $zindex-tooltip |
See ➜ 📄 Full scss file