Global

Tooltip

Small hints that appear on hover or keyboard focus. Four positions, three styles, rich content and a version that needs no JavaScript.

Examples

Positions

Add data-bs-toggle="tooltip" and the text in data-bs-title. Choose a side with data-bs-placement. site.js starts every tooltip on the page, and the Bootstrap JS bundle must be loaded first. The tooltip also opens when the keyboard focuses the element.

On icon buttons

Icon buttons have no visible text, so keep an aria-label too. The tooltip is a hint for people with a mouse, not a replacement for the label.

Styles

Add data-bs-custom-class="tooltip-light" or "tooltip-brass" to change the look.

Rich content

The asking price works out at $312 per sq ft, and the monthly cost includes the HOA fee.

Use data-bs-html="true" with tooltip-rich for a short title and a sentence. Never put links or buttons inside a tooltip, because it closes when the pointer leaves. Add .has-tip and tabindex="0" to plain text so it can be reached by keyboard.

Disabled button

A disabled button does not receive the pointer, so put the tooltip on a wrapper around it.

No JavaScript version

Put the text in data-tip. It works with CSS alone, follows the page direction for start and end, and is hidden on touch screens. Good for short labels, but it cannot wrap long text or hold HTML. Use the Bootstrap version for those.

Classes and attributes

NamePurpose
data-bs-toggle="tooltip"Turns the element into a tooltip trigger. Started by site.js.
data-bs-title or titleThe tooltip text.
data-bs-placementtop (default), bottom, left or right. Flips when there is no room.
data-bs-custom-classtooltip-light, tooltip-brass or tooltip-rich.
data-bs-html="true"Allows <strong> and other simple tags in the title.
.has-tipDotted underline and a help cursor for text that has a tooltip.
data-tip, data-tip-posTooltip without JavaScript. Position is top (default), bottom, start or end.