tooltip
A small text label that appears when a control is hovered or focused, describing it briefly.
In more detail
A tooltip must contain no interactive content, must appear on keyboard focus as well as hover, must close on Escape and is linked to its trigger with aria-describedby (or supplies the name of an icon button). Anything interactive belongs in a popover instead.
Example
The course measures the anchor with getBoundingClientRect in useLayoutEffect, and renders tooltips in a portal so parent overflow does not clip them.Related terms
- popover — A floating panel opened by an explicit click that can contain interactive content such as forms, links or a date picker.
- aria-describedby — An ARIA attribute that links an element to other elements, by id, whose text gives it a longer description.
- setTimeout — A JavaScript function that runs a callback once after at least the given number of milliseconds, unless clearTimeout cancels it first.
- useLayoutEffect — A version of useEffect that runs synchronously after React changes the DOM but before the browser paints the screen.
- portal — A React feature, createPortal, that renders a component's children into a different place in the DOM, usually document.body.
- getBoundingClientRect — A browser method that returns an element size and its position relative to the visible part of the page.
- language service — The part of TypeScript that editors talk to for live errors, hover information, auto-complete, renames and quick fixes.
- type inference — The compiler working out a type from the code itself, so you do not have to write it out by hand.
- doc comment — A comment starting with /** placed above a declaration, which editors show as documentation when you hover over it.
Taught in
- Compound Component Patterns: Context Sharing & Internal State — Design Systems & Component Engineering
- Overlay Architecture: Portals, Stacking Contexts & Backdrops — Design Systems & Component Engineering
- Floating Primitives: Popovers, Tooltips & Positioning — Design Systems & Component Engineering
- useLayoutEffect vs useEffect: Painting And Synchronous Reads — React 19 & Modern Component Architecture
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture
- Render Diagnostics: Profiling Re-Renders with React DevTools — React 19 & Modern Component Architecture
- Type Annotations, Type Inference And Contextual Typing — Production TypeScript
- Verify Your Environment: Running tsc And Bun TypeScript — Production TypeScript
- Tuples: Fixed Length, Labeled Elements And Variadic Tuples — Production TypeScript
- Typeof Guards, Truthiness And Equality Narrowing — Production TypeScript