Skip to content

useLayoutBox

Read as Markdown

import { useLayoutBox, Rectangle } from "@pibbl/core";

useLayoutBox() returns a readonly LayoutBox and is render-only, returning the stable allocation supplied by the current layout parent. It schedules no work and does not measure. Read it during render to adapt local drawing, rather than retaining it beyond the current render.

function FillAllocation() {
const { width, height } = useLayoutBox();
return <Rectangle style={{ width, height, fill: "#2563eb" }} />;
}

Try the Flex live example.

Returns the current stable child-local allocation without scheduling work.

useLayoutBox: () => Readonly<LayoutBox>

Related API: useLayoutBox, LayoutBox.

The current parent-assigned layout box in logical coordinates. See LayoutBox.

LayoutBox

View source — packages/core/src/lib/hooks/use-layout-box.ts:11

Read the Drawing, layout, and effects companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.

Documentation built with @pibbl/core 0.0.2, revision 380919b. ALPHA — NOT FOR PRODUCTION USE.