Tooltip

Tooltip

Tooltip shows a short hint from the data-tip attribute on hover or keyboard focus. It is CSS-only, so also give the trigger an accessible name.

Class names

Class nameTypeDescription
tooltipComponentWrapper that shows data-tip above on hover or focus
tooltip-bottomModifierShow the tip below
tooltip-startModifierShow the tip on the inline-start side
tooltip-endModifierShow the tip on the inline-end side

Tooltip

Hover or focus the button. The tip appears above by default.

<span class="tooltip" data-tip="Save changes">
  <button type="button" class="btn" aria-label="Save changes">Save</button>
</span>

Bottom

<span class="tooltip tooltip-bottom" data-tip="Below">
  <button type="button" class="btn" aria-label="Below">Bottom</button>
</span>

Start

Start and end follow the writing direction, so they flip in RTL.

<span class="tooltip tooltip-start" data-tip="Before">
  <button type="button" class="btn" aria-label="Before">Start</button>
</span>

End

<span class="tooltip tooltip-end" data-tip="After">
  <button type="button" class="btn" aria-label="After">End</button>
</span>

On an icon button

Icon-only triggers need an aria-label; the tip alone is not announced.

<span class="tooltip" data-tip="Add item">
  <button type="button" class="btn btn-primary" aria-label="Add item">
    <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>
  </button>
</span>