Create a highlight area for some element in the DOM. The component can place the highlight automatically when passing a component with forwardRef support as children, it is also possible to set the highlighted area if there is no children component.
Area highlight
React component
There are two different ways to create the highlighted area for a component, this allows the component to determine the highlight area and keep updating when there is scroll on the page. The first, set the component as the component’s children.
Another option is for cases where it is not possible to define the component as the only child of the <OverlayMask />, define the children as a function and the ref object is passed via render props to add to the element that should get the highlight.
The component can be controlled ie define a highlight area for a non-React element that is not managed by React, the difference is that you need to keep the area (bounds) updated if the page exists scroll.