Display prompt information for mouse hover.
Tooltip has 9 placements.
Tooltip has two built-in themes:
To use customized theme, you will have to known where your tooltip is rendered into, if your tooltip is rendered into the root element, you will need to set the css rule globally.
It is recommended that not using linear gradient background color when you using customized theme and showing the arrow at the same time, because the popup arrow and the content are two different elements, the popup arrow's style needs to be set individually, and when it comes to the gradient background color, it might seem a little bit weird.
Display multiple lines of text and set their format.
In addition to basic usages, there are some attributes that allow you to customize your own:
transition attribute allows you to customize the animation in which the tooltip shows or hides, and the default value is el-fade-in-linear.
disabled attribute allows you to disable
tooltip. You just need set it to
In fact, Tooltip is an extension based on ElPopper, you can use any attribute that are allowed in ElPopper.
router-link component is not supported in tooltip, please use
Disabled form elements are not supported for Tooltip, more information can be found at MDN. You need to wrap the disabled form element with a container element for Tooltip to work.
HTML as content
The content attribute can be set to HTML string.
content property supports HTML strings, dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS attacks. So when
raw-content is on, please make sure
content is trusted, and never assign user-provided
Sometimes we want to render the tooltip on some other trigger element, we can separate the trigger and the content.
Virtual triggering tooltip is controlled component, so that you will have to control the visibility of the tooltip your own when this happens, YOU WILL NOT be able to close the tooltip by clicking somewhere else.
Tooltip can also be singleton, which means you can have multiple trigger with only one tooltip instance, this function is implemented based on
Known issue: when using singleton, the popup will be bouncing out from unexpected places
Tooltip can be controlled by the parent component, by using
:visible you can implement two way binding.
Tooltip can be customized animated, you can set the desired animation function as you desired.
|append-to||which element the tooltip CONTENT appends to||—|
|effect||Tooltip theme, built-in theme: ||dark|
|content||display content, can be overridden by ||''|
|placement||position of Tooltip||bottom|
|visible / v-model:visible||visibility of Tooltip||—|
|disabled||whether Tooltip is disabled||—|
|offset||offset of the Tooltip||12|
|show-after||delay of appearance, in millisecond||0|
|show-arrow||whether the tooltip content has an arrow||true|
|hide-after||delay of disappear, in millisecond||200|
|auto-close||timeout in milliseconds to hide tooltip||0|
|popper-class||custom class name for Tooltip's popper||—|
|enterable||whether the mouse can enter the tooltip||true|
|teleported||whether tooltip content is teleported, if ||true|
|trigger||How should the tooltip be triggered (to show)||hover|
|virtual-triggering||Indicates whether virtual triggering is enabled||—|
|virtual-ref||Indicates the reference element to which the tooltip is attached||—|
|trigger-keys||When you click the mouse to focus on the trigger element, you can define a set of keyboard codes to control the display of tooltip through the keyboard||['Enter','Space']|
|persistent||when tooltip inactive and ||—|
|aria-label a11y||same as ||—|
|default||Tooltip triggering & reference element|
|popperRef||el-popper component instance|
|contentRef||el-tooltip-content component instance|
|isFocusInsideContent||validate current focus event is trigger inside el-tooltip-content|
|updatePopper||update el-popper component instance|
|onOpen||expose onOpen function to mange el-tooltip open state|
|onClose||expose onClose function to mange el-tooltip open state|
|hide||expose hide function|