getBoundingClientRect

A browser method that returns an element size and its position relative to the visible part of the page.

In more detail

Reading it forces the browser to finish any pending layout, so call it only when needed. The values change as the page scrolls.

Example

Tooltips measure their anchor with it inside useLayoutEffect.

Related terms

Taught in

References