@reach-ui-fork/rect
v0.18.1
Published
Measure React elements position in the DOM
Downloads
472
Readme
@reach-ui-fork/rect
Measures DOM elements (aka. bounding client rect). See also Element.getBoundingClientRect()
import { Rect, useRect } from "@reach-ui-fork/rect";
function Example() {
const ref = React.useRef();
const rect = useRect(ref);
return (
<div>
<pre>{JSON.stringify(rect, null, 2)}</pre>
<div
ref={ref}
contentEditable
dangerouslySetInnerHTML={{
__html: "Edit this to change the size!",
}}
/>
</div>
);
}