Floating UI
A JavaScript library, and the general technique, for positioning a floating element such as a tooltip next to a reference element.
In more detail
Floating UI computes coordinates from the reference element's bounding box and applies middleware such as flip (move to the opposite side when there is no room) and shift (slide along the edge to stay visible). It also positions arrow pointers.
Related terms
- collision detection — Checking whether a floating element would run off the edge of the viewport and moving it if so.
- bounding box — The smallest rectangle that encloses a shape or element, given by its position and size or by two opposite corners.
- CSS anchor positioning — A CSS feature that positions an element relative to another named anchor element, with built-in fallbacks when it would overflow.
- tooltip — A small text label that appears when a control is hovered or focused, describing it briefly.
Taught in
- Floating Primitives: Popovers, Tooltips & Positioning — Design Systems & Component Engineering