API Docs 0.11.3.33c7ec07

Component that implements Bootstrap tooltips.

By default it will attach its listeners (mouseover and focus) to the parent DOM element to trigger the tooltip:

<button class="btn">
  {{bs-tooltip title="This is a tooltip"}}
</button>

You can also use the component in a block form to set the title:

<button class="btn">
  {{#bs-tooltip}}This is a tooltip{{/bs-tooltip}}
</button>

Trigger

The trigger element is the DOM element that will cause the tooltip to be shown when one of the trigger events occur on that element. By default the trigger element is the parent DOM element of the component, and the trigger events will be "hover" and "focus".

The triggerElement property accepts any jQuery selector to attach the tooltip to any other existing DOM element. With the special value "parentView" you can attach the tooltip to the DOM element of the parent component:

{{#my-component}}
  {{bs-tooltip title="This is a tooltip" triggerElement="parentView"}}
{{/my-component}}

To customize the events that will trigger the tooltip use the triggerEvents property, that accepts an array or a string of events, with "hover", "focus" and "click" being supported.

Placement options

By default the tooltip will show up on top of the trigger element. Use the placement property to change that ("top", "bottom", "left" and "right"). To make sure the tooltip will not exceed the viewport (see Advanced customization) you can set autoPlacement to true. A tooltip with `placement="right" will be placed to the right if there is enough space, otherwise to the left.

Advanced customization

Several other properties allow for some advanced customization:

  • visible to show/hide the tooltip programmatically
  • fade to disable the fade in transition
  • delay (or delayShow and delayHide) to add a delay
  • viewportSelector and viewportPadding to customize the viewport that affects autoPlacement

See the individual API docs for each property.

Actions

When you want to react on the tooltip being shown or hidden, you can use one of the following supported actions:

  • onShow
  • onShown
  • onHide
  • onHidden
Show:

Methods

applyPlacement

private

Position the tooltip/popover

Parameters:

  • offset Object
  • placement Object

enter

private

Called when a show event has been received

Parameters:

  • e Object

getViewportAdjustedDelta Top: number, left: number

private

Parameters:

  • placement Object
  • pos Object
  • actualWidth Object
  • actualHeight Object

Returns:

Top: number, left: number:

}

hide

private

Hide the tooltip/popover

leave

private

Called when a hide event has been received

Parameters:

  • e Object

replaceArrow

private

Position the tooltip/popover's arrow

Parameters:

  • delta Object
  • dimension Object
  • isVertical Object

show

private

Show the tooltip/popover

toggle

private

Called for a click event

Parameters:

  • e Object

Properties

_renderInPlace boolean

private

arrowElement object

private

The jQuery object of the arrow element.

autoPlacement boolean

public

When true it will dynamically reorient the tooltip/popover. For example, if placement is "left", the tooltip/popover will display to the left when possible, otherwise it will display right.

Default: false

delay number

public

Delay showing and hiding the tooltip/popover (ms). Individual delays for showing and hiding can be specified by using the delayShow and delayHide properties.

Default: 0

delayHide number

public

Delay hiding the tooltip/popover. This property overrides the general delay set with the delay property.

Default: 0

delayShow number

public

Delay showing the tooltip/popover. This property overrides the general delay set with the delay property.

Default: 0

fade boolean

public

Set to false to disable fade animations.

Default: true

hoverState string

private

Current hover state, 'in', 'out' or null

in boolean

private

Used to apply Bootstrap's "in" class

Default: false

inState {InState}

private

Current state for events

overlayElement object

private

The jQuery object of the overlay element.

overlayId string

private

The id of the overlay element.

renderInPlace boolean

public

If true component will render in place, rather than be wormholed.

Default: false

timer unknown

private

Ember.run timer

title string

public

transitionDuration number

public

The duration of the fade transition

Default: 150

triggerElement string

public

The DOM element that triggers the tooltip/popover. By default it is the parent element of this component. You can set this to any jQuery selector to have any other element trigger the tooltip/popover. With the special value of "parentView" you can attach the tooltip/popover to the parent component's element.

triggerEvents array|string

public

The event(s) that should trigger the tooltip/popover - click | hover | focus. You can set this to a single event or multiple events, given as an array or a string separated by spaces.

Default: 'hover focus'

triggerTargetElement {jQuery}

private

usesTransition boolean

private

Use CSS transitions when showing/hiding?

viewportElement object

private

The jQuery object of the viewport element.

viewportPadding number

public

Take a padding into account for keeping the tooltip/popover within the bounds of the element given by viewportSelector.

Default: 0

viewportSelector string

public

Keeps the tooltip/popover within the bounds of this element when autoPlacement is true. Can be any valid jQuery selector.

Default: 'body'

visible boolean

public

You can programmatically show the tooltip/popover by setting this to true

Default: false

Events

onHidden

public

This action is called when the tooltip/popover has finished being hidden from the user (will wait for CSS transitions to complete).

onHide

public

This action is called immediately when the tooltip/popover is about to be hidden.

onShow

public

This action is called immediately when the tooltip/popover is about to be shown.

onShown

public

This action will be called when the tooltip/popover has been made visible to the user (will wait for CSS transitions to complete).