@empoleon/solid-measure
Version:
Compute measurements of SolidJS components
26 lines (22 loc) • 641 B
text/typescript
import { JSX } from "solid-js";
import withContentRect, {
WithContentRectChildrenProps,
} from "./with-content-rect";
export interface MeasureProps {
client?: boolean;
offset?: boolean;
scroll?: boolean;
bounds?: boolean;
margin?: boolean;
children: (props: WithContentRectChildrenProps) => JSX.Element;
innerRef?: ((el: Element) => void) | { current?: Element | null };
onResize?: (contentRect: any) => void;
}
const Measure = withContentRect()<MeasureProps>((props) =>
props.children({
measure: props.measure,
measureRef: props.measureRef,
contentRect: props.contentRect,
})
);
export default Measure;