Tooltip
The plain tooltip: a short label that appears beside a control on mouse rest or keyboard focus and repeats or adds to the control's name.
When to use
- On every icon button: the tooltip shows the same words as its accessible name, so people who see the icon can read what it does (canonical §10.2, D-CAI-07).
- On a control that shows only a mark, such as the platform tiles that hold a product's mark (D-CSN-24, D-CSN-38).
When not to use
- For anything a person needs to complete a task: instructions, formats, errors, and limits are visible text (text-field.md, banner.md). A tooltip is supplementary only and never the only copy (D-CSN-24).
- On touch-only screens, where nothing hovers: information they need is on screen as text.
- For a title, several sentences, a link, or a button: a popover.
- For feedback after an action: a snackbar.
- Never use the
titleattribute as a tooltip; it is not keyboard-accessible, cannot be dismissed, and is not styled (D-CSN-24).
Anatomy
- Trigger: a control that already has a name (an
[aria-label]or visible text) and points at the tooltip with[aria-describedby]. - Container (
.oa-tooltip):inverse-surfacein both themes,rounded-4px, 4px above and below and 8px at the sides, at least 24px tall, at most 240px wide, a transparent 1px edge, no shadow, on the tooltip layer. - Text:
body-sm(12/16) ininverse-on-surface. - Anchor (
.oa-tooltip__anchor): the element around the trigger and the tooltip that places it when no library does.
Variants
The plain tooltip is the only tooltip in 1.0; a panel with a title and more text is the popover. Its placement varies:
| Placement | Use for | Attribute |
|---|---|---|
| Above, centered (default) | Most controls | none |
| Below | Controls near the top of the window: header and app-bar buttons | [data-side="bottom"] |
| Aligned to the start or the end | Controls at the edge of a row or the window, so the tooltip stays on screen | [data-align="start"], [data-align="end"] |
Sizes
| Part | Size | Token |
|---|---|---|
| Width | its text, at most 240px; longer text wraps | --container-tooltip (max-w-tooltip) (D-ARC-24) |
| Height | at least 24px | min-h-6 |
| Padding | 4px above and below, 8px at the sides | --space-1, --space-2 |
| Text | 12/16 (body-sm), the smallest size that may carry meaning |
--text-body-sm (canonical §3.8) |
| Distance to the trigger | 4px | --space-1 |
| Corners | 4px | --radius-4px |
Tokens
| Part | Property | Token (CSS · Tailwind) |
|---|---|---|
| Container | background | --color-inverse-surface · bg-inverse-surface (dark in both themes) |
| Text | color | --color-inverse-on-surface · text-inverse-on-surface |
| Text | type | --text-body-sm · text-body-sm |
| Container | corners, edge | --radius-4px · rounded-4px; 1px transparent |
| Container | layer | --z-tooltip · z-70, above everything it can point at |
| Container | width | --container-tooltip · max-w-tooltip |
| Timing | delay on mouse rest | --duration-delay-tooltip (500ms), read by the script, never a literal |
| Motion | enter, exit | opacity over --duration-short-3: enters with --ease-standard, leaves with --ease-emphasized-accelerate |
States
| State | What changes |
|---|---|
| Hidden | [hidden]; nothing is drawn. Its words still describe the trigger, because [aria-describedby] reads hidden elements. |
| Showing | After 500ms of mouse rest on the trigger, or at once when the trigger gets keyboard focus; it fades in over duration-short-3 (canonical §7.3). |
| Shown | Stays while the pointer is over the trigger or the tooltip, and while the trigger has focus. |
| Hiding | On Escape, on blur, and when the pointer leaves both; it fades out over duration-short-3 with ease-emphasized-accelerate. |
The tooltip has no hover, pressed, or focus state of its own; it is not focusable.
Behavior
- Delay: the script waits
--duration-delay-tooltip(500ms) after the pointer comes to rest on the trigger; keyboard focus shows it at once (canonical §10.20). - Hoverable and dismissible: it stays while the pointer moves onto it and hides on Escape without moving focus (WCAG 1.4.13).
- One at a time: showing a tooltip hides any other.
- Placement: above the trigger, centered, 4px apart; below when there is no room above (
[data-side="bottom"]); aligned to the trigger's start or end near the edge of the window ([data-align]). Radix Tooltip sets[data-side]and[data-align]and flips by itself. - Reduced motion: no fade; the delay still applies, because it is a timer, not motion (D-SEM-21).
const delay = parseFloat(getComputedStyle(document.documentElement)
.getPropertyValue('--duration-delay-tooltip')); // 500, from the tokens
let timer;
const show = () => { clearTimeout(timer); tip.hidden = false; };
const hide = () => { clearTimeout(timer); tip.hidden = true; };
trigger.addEventListener('pointermove', (event) => { // waits for the mouse to rest
if (event.pointerType !== 'mouse' || !tip.hidden) return;
clearTimeout(timer);
timer = setTimeout(show, delay);
});
anchor.addEventListener('pointerleave', () => { // the anchor holds trigger and tooltip
if (!trigger.matches(':focus-visible')) hide(); // keyboard focus keeps it shown
});
trigger.addEventListener('focus', () => { if (trigger.matches(':focus-visible')) show(); });
trigger.addEventListener('blur', hide);
document.addEventListener('keydown', (event) => { if (event.key === 'Escape') hide(); });Accessibility
- Role:
role="tooltip"with anid; the trigger points at it with[aria-describedby](D-CSN-24). - Names: the trigger keeps its own name; the tooltip adds to it and never replaces it. For icon buttons it repeats the name in the same words (canonical §10.2).
- WCAG 1.4.13: dismissible with Escape, hoverable, and persistent until blur, pointer-out, or Escape.
- Never the
titleattribute: keyboard and touch users never see it. - Contrast:
inverse-on-surfaceoninverse-surfaceis 11.63:1 light and 13.83:1 dark (tokens/contrast.md). In dark the box itself sits close to the page; the words carry it. - Text size: 12px, the minimum for text that carries meaning (canonical §3.8).
- Reduced motion: no fade (D-SEM-21).
RTL and languages
- Centered tooltips need no mirroring.
[data-align="end"]aligns the tooltip with the trigger's inline end, the left edge in Arabic; overlay.css uses logical properties and flips the centering shift with:dir(rtl)(D-BCP-30). - Arabic
body-smruns at line height 1.75, so an Arabic tooltip is a little taller; never fix its height (D-TYP-14). - Translate the words with the trigger's name: "Close" / "إغلاق" / "Fermer"; "Language: English" / "اللغة: العربية" / "Langue : Français".
- French runs about 26% longer overall and up to 32% for short labels; the tooltip wraps at 240px (D-TYP-15).
Content
- The control's name in sentence case, without a full stop: the same words as its
[aria-label](canonical §10.2). - Say what the control does or where it goes, verb first when it acts: "Close", "Menu", "Remove the passkey added 27 October 2026", "More actions for Rania Haddad", "Language: English".
- No "Click to …", no instructions, no essential facts (canonical §12.5).
Do and don't
- Do give every icon button a name and the tooltip with the same words. Don't rely on the tooltip as the button's only name.
- Do show it at once on keyboard focus. Don't make keyboard users wait or hover.
- Do keep it to a few words. Don't put a link, a button, or a paragraph in it; use a popover.
- Do let Escape hide it. Don't use the
titleattribute.
Code
HTML (reference CSS)
The snippet's examples (reference/snippets/overlays.html). Documentation shows the tooltips open with .oa-tooltip__anchor--demo, which lays trigger and tooltip out in the page flow, and forces focus with [data-demo-focus]; in a product drop both, start the tooltip with [hidden], and let the script show it.
Above the trigger:
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Close" aria-describedby="ov-tip-close">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-close">Close</span>
</span>
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Remove the passkey added 27 October 2026" aria-describedby="ov-tip-remove" data-demo-focus>
<span class="oa-icon" aria-hidden="true" translate="no">delete</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-remove">Remove the passkey added 27 October 2026</span>
</span>Below the trigger, aligned to its end:
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Menu" aria-describedby="ov-tip-menu">
<span class="oa-icon" aria-hidden="true" translate="no">menu</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-menu" data-side="bottom">Menu</span>
</span>
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="Language: English" aria-describedby="ov-tip-lang">
<span class="oa-icon" aria-hidden="true" translate="no">translate</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-lang" data-side="bottom" data-align="end">Language: English</span>
</span>Arabic, on a page with <html lang="ar" dir="rtl">:
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="إغلاق" aria-describedby="ov-tip-close-ar">
<span class="oa-icon" aria-hidden="true" translate="no">close</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-close-ar">إغلاق</span>
</span>
<span class="oa-tooltip__anchor oa-tooltip__anchor--demo">
<button class="oa-icon-btn" type="button" aria-label="اللغة: العربية" aria-describedby="ov-tip-lang-ar">
<span class="oa-icon" aria-hidden="true" translate="no">translate</span>
</button>
<span class="oa-tooltip" role="tooltip" id="ov-tip-lang-ar" data-side="bottom" data-align="end">اللغة: العربية</span>
</span>Tailwind CSS v4
<span class="relative inline-flex align-middle">
<!-- the trigger: an icon button with aria-label and aria-describedby -->
<span role="tooltip" id="tip-close" hidden class="absolute bottom-full start-1/2 mb-1 -translate-x-1/2 rtl:translate-x-1/2 z-70 block w-max max-w-tooltip min-h-6 rounded-4px border border-transparent bg-inverse-surface px-2 py-1 text-body-sm text-inverse-on-surface transition-opacity duration-short-3 ease-standard starting:opacity-0">Close</span>
</span>Below the trigger: data-[side=bottom]:top-full data-[side=bottom]:bottom-auto data-[side=bottom]:mt-1 data-[side=bottom]:mb-0. With Radix Tooltip, drop the placement classes; Radix places its wrapper.
React
A Tooltip on Radix Tooltip:
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
required | The words: the same as the trigger's accessible name for an icon button. |
side |
'top' | 'bottom' |
'top' |
Preferred side; Radix flips it when there is no room. |
align |
'start' | 'center' | 'end' |
'center' |
Alignment with the trigger. |
children |
ReactElement |
required | The trigger, rendered asChild; it must already have a name. |
// Read the delay from the tokens once, on the client (500ms).
const delay = parseFloat(getComputedStyle(document.documentElement).getPropertyValue('--duration-delay-tooltip'))
<Tooltip.Provider delayDuration={delay}>
<Tooltip label={t('close')}>
<IconButton icon="close" label={t('close')} onClick={onClose} />
</Tooltip>
</Tooltip.Provider>Inside, Tooltip.Content takes side, align, sideOffset={4}, and the recipe above without its placement classes.