Bootstrap 4 Tutorial
BS4 Introduction BS4 Getting Started BS4 Containers BS4 Typography BS4 Grid Basics BS4 Tables BS4 Images BS4 Jumbotron BS4 Buttons BS4 Button Groups BS4 Spinners BS4 Alerts BS4 Dropdowns BS4 Collapse BS4 Navs BS4 Navbars BS4 Pagination BS4 Breadcrumbs BS4 Badges BS4 Progress Bars BS4 List Groups BS4 Cards BS4 Forms BS4 Inputs BS4 Input Groups BS4 Custom Forms BS4 Carousel BS4 Modal BS4 Tooltips BS4 Popovers BS4 Toast BS4 Scrollspy BS4 Media Objects BS4 Filters BS4 Utilities Bootstrap 3 vs. Bootstrap 4
Bootstrap 4 Grid
BS4 Grid System BS4 Grid XSmall BS4 Grid Small BS4 Grid Medium BS4 Grid Large BS4 Grid XLarge
Bootstrap 4 Reference
JS Alert JS Carousel JS Collapse JS Dropdown JS Modal JS Popover JS Tab JS Toasts JS Tooltip

Bootstrap 4 Tooltips

A Tooltip is used to provide interactive textual hints to the user about the element when the mouse pointer moves over.

Hover over me

How to Create a Tooltip

The data-toggle="tooltip" attribute is used to create a tooltip.

Use the title attribute to specify the text that should be displayed inside the tooltip.

Note: Tooltips must be initialized with jQuery.

One way to initialize all tooltips on a page would be to select them by their data-toggle attribute and call the tooltip() method.

The following code will enable all tooltips in the document:

Run code

Positioning Tooltips

Use the data-placement attribute to set the position of the tooltip on top, right, bottom, or the left side of the element.

Hover over the buttons below to see tooltip directions: top, right, bottom, and left:

Run code

The placement attributes do not work as you expect if it is not enough room for them. For example: if you use the top placement at the top of a page (where it is no room for it), it will instead display the tooltip below the element or to the right (wherever it is room for it).

Tooltip with HTML Elements

Use the data-html="true" attribute to add custom HTML in tooltips.

Run code

Disabled Elements

Elements with the disabled attribute aren’t interactive, meaning users cannot focus, hover, or trigger a tooltip.

To solve this problem, wrap your element in a <div> or <span>, made keyboard-focusable using tabindex attribute, and override the pointer-events property on the disabled element.

Run code

Styling Tooltips

If you want to change the appearance of tooltips consider the following example:

Run code

Complete Bootstrap 4 Tooltip Reference

For a complete reference of all tooltip options, methods and events, visit our Bootstrap 4 JS Tooltip Reference.