Methods
#Instance methods
Methods on instances allow you to control the tippy programmatically. See theTippy Instance page for details on accessing an instance.
#show
Programmatically show the tippy at any time:
instance.show();
#hide
Programmatically hide the tippy at any time:
instance.hide();
#hideWithInteractivity
Available from
v6.2.0
Will hide the tippy only if the cursor is outside of the tippy's interactiveregion. This allows you to programmatically hook intointeractive
behaviorupon amouseleave
event if implementing custom event listeners.
// Required: pass the mouse event object in from your event listenerinstance.hideWithInteractivity(mouseEvent);
#disable
Temporarily prevent a tippy from showing or hiding:
instance.disable();
#enable
Re-enable a tippy:
instance.enable();
#setProps
You can update any prop after the instance has been created. Pass an object ofnew props in:
instance.setProps({arrow:true,animation:'scale',});
#setContent
Updating thecontent
prop has its own method as a shortcut:
instance.setContent('New content');
#unmount
Unmount the tippy from the DOM:
instance.unmount();
This allows you to integrate spring animation libraries as an alternative toCSS. For instance, you'd call this in theironComplete()
(or equivalent)callback.
#clearDelayTimeouts
Clears the instance'sdelay
timeouts. There will likely be only very rare usecases for this.
instance.clearDelayTimeouts();
#destroy
To permanently destroy and clean up the instance, use this method:
instance.destroy();
The_tippy
property is deleted from the reference element upon destruction.
#Static methods
Static methods belong to thetippy
module for global behavior.
#setDefaultProps
Set the default props for each new instance:
tippy.setDefaultProps({// Props});// Access the current default propstippy.defaultProps;
#hideAll
Hide all visible tippies on the document:
import{hideAll}from'tippy.js';// Use each tippy's own durationhideAll();// Hide them all instantlyhideAll({duration:0});// Hide them all except a particular onehideAll({exclude:tippyInstance});hideAll({exclude:referenceElement});
In the CDN (umd
) version, it's available astippy.hideAll()
.