Pilates
    Preparing search index...

    Function useBoxMetrics

    • Read the most recent computed layout (left / top / width / height) of a <Box> referenced by ref. Returns null until the ref attaches and the first layout pass completes.

      The hook tracks two re-render triggers so consumers see fresh values:

      1. SIGWINCH via useStdout() — terminal resize re-renders the consumer because columns / rows are part of the dep graph.
      2. Post-commit force via a useEffect that bumps an internal version after every commit. Without this, a layout change driven purely by sibling state (which doesn't re-render the consumer) would leave the consumer reading stale metrics.

      Consumers should treat the return value as advisory: it reflects the layout AT THE TIME of the consumer's render, which is one commit behind the actual frame for the very first mount (null until the post-commit effect bumps).

      Parameters

      • ref: RefObject<unknown>

      Returns BoxMetrics | null