Skip to content
Enact

ui/Measurable

A higher-order component that adds the ability to measure nodes conveniently.

A higher-order component that adds the ability to measure a referenced node and get that value back as a prop.

Applying Measurable to a component will pass two additional props: function to fetch the ref and the measurement object (currently this executes getBoundingClientRect returning its full complement of properties). Both prop names are configurable through the HOC config object.

Changes to the referenced node will result in new measurements being returned as props. That being said, it probably is not wise to use this during animation as it may cause unwanted performance issues.

Configuration

Configures the prop name to pass the measurement object.

Default: 'measurement'

Configures the prop name to pass a function to capture a reference to the element to measure.

Default: 'forwardRef'