Overview
The useMaxHeight hook returns the maximum height constraint (in pixels) for the widget, if one is set by the platform.
Import
import { useMaxHeight } from 'sunpeak';
Signature
function useMaxHeight(): number | null
Returns
The maximum height in pixels, or null if no constraint is set.
Usage
import { useMaxHeight } from 'sunpeak';
function MyWidget() {
const maxHeight = useMaxHeight();
return (
<div style={{ maxHeight: maxHeight ? `${maxHeight}px` : 'none', overflow: 'auto' }}>
Content that respects height constraints
</div>
);
}