Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 3.91 KB

tooltip-documentation.md

File metadata and controls

54 lines (41 loc) · 3.91 KB

Tooltip

Kind: global class

new Tooltip(reference, options, reference, options)

Create a new Tooltip.js instance

Returns: Object - instance - The generated tooltip instance

Param Type Default Description
reference HTMLElement The reference element used to position the tooltip
options Object
options.placement String bottom Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
reference HTMLElement The DOM node used as reference of the tooltip (it can be a jQuery element).
options Object Configuration of the tooltip
options.container HTMLElement | String | false false Append the tooltip to a specific element.
options.delay Number | Object 0 Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: { show: 500, hide: 100 }
options.html Boolean false Insert HTML into the tooltip. If false, the content will inserted with innerText.
options.placement String | PlacementFunction 'top' One of the allowed placements, or a function returning one of them.
options.template String '<div class="tooltip" role="tooltip">
' Base HTML to used when creating the tooltip. The tooltip's title will be injected into the .tooltip-inner or .tooltip__inner. .tooltip-arrow or .tooltip__arrow will become the tooltip's arrow. The outermost wrapper element should have the .tooltip class.
options.title String | HTMLElement | TitleFunction '' Default title value if title attribute isn't present.
options.trigger String 'hover focus' How tooltip is triggered - click
options.boundariesElement HTMLElement The element used as boundaries for the tooltip. For more information refer to Popper.js' boundariesElement docs
options.offset Number | String 0 Offset of the tooltip relative to its reference. For more information refer to Popper.js' offset docs

Tooltip.PlacementFunction ⇒ String

Placement function, its context is the Tooltip instance.

Kind: static typedef of Tooltip
Returns: String - placement - One of the allowed placement options.

Param Type Description
tooltip HTMLElement tooltip DOM node.
reference HTMLElement reference DOM node.

Tooltip.TitleFunction ⇒ String

Title function, its context is the Tooltip instance.

Kind: static typedef of Tooltip
Returns: String - placement - The desired title.