Overlays & display
Tooltip
Infobulle
Demo
Loading demo…
A small label that shows up when you hover or focus an element. It names an icon button or adds a short detail, then disappears as soon as you move away.
Story
Did you know
In 1991 Apple launched "Balloon Help" in System 7, comic-style speech bubbles. Hardly anyone turned it on; Windows 95 is what made the little yellow rectangle we know the norm.
Timeline
- 1991Balloon Help in Mac System 7.
- 1995Windows 95 makes toolbar tooltips widespread.
- 1990sThe HTML
titleattribute gives web pages a native tooltip. - 2020sDesign systems require tooltips on focus and a delay before they appear.
Vocabulary
Names
- FR
- Infobulle, bulle d'aide, info-bulle, tooltip
- EN
- Tooltip, hint, balloon help, title text, ScreenTip
Common uses
- Name a button that only has an icon
- Show the exact value of a chart point
- Explain a keyboard shortcut
Often paired with
The components it usually sits with, by page type, in reading order.
Blog post
See the mock-upSocial feed
See the mock-upPricing page
See the mock-upCode
<span class="tt">
<button aria-labelledby="tip-bold"><b aria-hidden="true">B</b></button>
<span id="tip-bold" role="tooltip" hidden>Bold <kbd>Ctrl B</kbd></span>
</span>
<style>
.tt { position: relative; display: inline-block; }
[role="tooltip"] { position: absolute; bottom: calc(100% + 6px); left: 50%;
translate: -50%; white-space: nowrap; }
</style>
<script>
const tt = document.querySelector('.tt')
const tip = tt.querySelector('[role="tooltip"]')
const show = () => (tip.hidden = false)
const hide = () => (tip.hidden = true)
// Wrapper events keep the tooltip open while the pointer moves onto it
tt.addEventListener('mouseenter', show)
tt.addEventListener('mouseleave', hide)
tt.addEventListener('focusin', show)
tt.addEventListener('focusout', hide)
tt.addEventListener('keydown', e => e.key === 'Escape' && hide())
</script>Good to know
- The
titleattribute is the native tooltip, but it is slow to appear, impossible to style, missing on touch and keyboard, and poorly read by screen readers. - Never put essential information in it: there is no hover on a touchscreen.
- Add a short delay before showing on hover, so tooltips don't flicker as the mouse crosses a toolbar. Once one is open, its neighbours can show right away.
- With
position: absolute, anoverflow: hiddenparent clips the tooltip. The top layer (popover="manual", orpopover="hint", still Chromium-only) plus anchor positioning fix that.
Accessibility
Must have
- The tooltip gets
role="tooltip". Link it witharia-labelledbywhen it names an icon button, witharia-describedbywhen it adds a detail. - It shows on hover and on keyboard focus, or some people never see it.
- It never takes focus and holds nothing clickable. Need a link or a button inside? Use a popover.
Often forgotten
- WCAG 1.4.13: Escape dismisses it without moving focus, the pointer can move onto it without it vanishing, and it stays as long as hover or focus lasts.
- A
disabledbutton gets no focus, and often no mouse events: its tooltip never shows. Usearia-disabled="true"instead.
Nice to have
- When the tooltip shows a shortcut, declare it on the button too with
aria-keyshortcuts="Control+B". - Skip tooltips that repeat the button's visible text: it is just noise for screen readers.