Tooltips

Tooltips can be applied through the use of data-attributes and can be added to regular HTML elements, or to HTML/Form helpers.

<a href="#" data-toggle="tooltips" title="first tooltip">Hover over me</a>
{{
    html.link({
        'href': '#',
        'label': 'Hover over me',
        'title': 'My tooltip',
        'data-toggle': 'tooltips'
    })
}}

Variations

Choose the most appropriate placement to fit your UI, try to avoid the tooltip from obscuring important things when it appears.

See the Pen docs - component - tooltip placements by Pulsar (@pulsar) on CodePen.

Options

Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data- as in data-animation="".

Name type default description
animation boolean true apply a CSS fade transition to the tooltip
html boolean false Insert HTML into the tooltip. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks.
placement string | function 'top' how to position the tooltip - top | bottom | left | right | auto.
When "auto" is specified, it will dynamically reorient the tooltip. For example, if placement is "auto left", the tooltip will display to the left when possible, otherwise it will display right.
selector string false If a selector is provided, tooltip objects will be delegated to the specified targets.
title string | function '' default title value if title attribute isn't present
trigger string 'hover focus' how tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
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: delay: { show: 500, hide: 100 }

container string | false false

Appends the tooltip to a specific element. Example: container: 'body'

Adding tooltips to disabled buttons

The disabled parameter prevents mouse events from firing and stops tooltips from working entirely. The only way around this which works for all our supported browsers is to wrap the button in a containing div, and attach the tooltip to that element.

<div rel="tooltip" data-toggle="tooltip" title="My tooltip brings all the boys to the yard">
  {{ html.button({ ... }) }}
</div>

results matching ""

    No results matching ""