
Description
react-height is a component wrapper for React that measures the height of the elements inside it and reports that height to your code. You wrap one or more children in the component, and it calls your onHeightReady callback when the height is measured and again whenever it changes. The README says it only checks immediate children, so it does not track nested height changes, and that it is not based on specific browser APIs, so it can be used in other environments too. You can pass a getElementHeight function to measure the element differently, and it defaults to reading clientHeight. A hidden prop lets the wrapper render nothing once the height is known, and all other props are applied to the container being measured, so you can pass style or className. The package installs from npm or yarn, and the README also gives a script tag option for pages that do not use a bundler. There is a simple web demo and a CodePen demo, and the project is released under the MIT license.…
Highlights
- Reports the height of children to your code
- Calls back when the height changes
- Checks immediate children only
- Custom measuring function
- Hidden prop to render nothing after measuring
Ratings & Reviews
No ratings yet
Be the first to rate react-height.
People also visit

react-animate-height
Lightweight React component for animating height using CSS transitions

react-collapse
Component-wrapper for collapse animation for elements with variable

react-on-screen
A wrapper component to track if your react component is visible on screen
react-height FAQ
What is react-height?
A React component wrapper that measures its children's height and reports it through a callback.
Does it track nested elements?
No. The README says it only checks immediate children, so changes deeper in the tree are not tracked.
How do I install it?
Install from npm or yarn, or use the script tag option for pages without a bundler, as described in the README.
Can I measure an element differently?
Yes. The getElementHeight prop takes your own function, and by default it reads clientHeight.
What license is it under?
MIT, as stated in the README.
What are the best react-height alternatives?
Popular alternatives to react-height include react-container-query, react-animate-height and react-collapse. See all react-height alternatives
















