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.
<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: { |
| closeOnEscape | Close when pressing escape key | boolean | - | From config: tooltip: { |
| closeOnOutside | Close when clicked outside of the panel | boolean | - | From config: tooltip: { |
deprecated - will be only boolean - use closeOnOutside and closeOnEscape instead | 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 |
| openOnClick | Show when clicked on the trigger | boolean | - | From config: tooltip: { |
| openOnContextmenu | Show when right clicked on the trigger | boolean | - | From config: tooltip: { |
| openOnFocus | Show when trigger get focused | boolean | - | From config: tooltip: { |
| openOnHover | Show when hover over the trigger | boolean | - | From config: tooltip: { |
| 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: { |
deprecated - will be removed - use triggerOnClick, triggerOnHover, triggerOnContextmenu and `triggerOnFocus, instead | ("focus" | "click" | "contextmenu" | "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 | event Event - native event | on active state changes to false |
| open | event Event - native event | on active state changes to true |
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-zindex | map.get(vars.$zindex, "tooltip") |
| $tooltip-content-font-size | 0.85rem |
| $tooltip-content-color | h.useVar("white") |
| $tooltip-content-font-weight | h.useVar("font-weight") |
| $tooltip-content-line-height | h.useVar("line-height") |
| $tooltip-content-padding | 0.35em 0.75em |
| $tooltip-content-multiline-width | 300px |
| $tooltip-content-box-shadow | h.useVar("overlay-box-shadow") |
| $tooltip-content-background-color | h.useVar("grey-darkest") |
| $tooltip-content-border-radius | h.useVar("border-radius") |
| $tooltip-arrow-margin | 2px |
| $tooltip-arrow-size | 5px |
See ➜ 📄 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 ➜ 📄 SCSS file
