What
Adds an opt-in placement prop to <Legend>. The default "overlay" is unchanged; placement="block" renders the same legend in normal flow above the plot, so it reserves its own height and can't overlap the chart at any width.
<PieChart data={data} config={config} dataKey="v" nameKey="name" innerRadius={0.6}>
<Legend placement="block" align="center" isClickable />
<Pie />
</PieChart>Closes #7.
Why
<Legend> is an absolute overlay pinned to the top of the plot, so it reserves no layout space. Past ~3 entries (or in a narrow card) flex-wrap pushes rows onto the plot, and the wrap count changes with width — a chart that looks fine at one size overlaps at another. BlockLegend already exists as a separate, config-fed component; this is the lighter Legend placement="block" the issue floated (direction 2), keeping the same composed API, chart context, and isClickable / align / hover-spotlight behavior.
How
legend.tsx— addplacement?: "overlay" | "block"(default"overlay"); the wrapper isabsolute inset-x-0 top-0for overlay, in-flow (w-full pb-2) for block.cartesian-root.tsx/polar-root.tsx— a block-placement legend routes to a flow slot: the root becomes aflex flex-col, the legend sits above aflex-1plot area that holds the canvas/svg/overlay chrome. Pure flexbox reservation — no measurement, no feedback loop.
Non-breaking: with no block legend the flow slot is empty and the layout is identical to before. No changes to the controllers or the shared context. Most of the root diff is one level of added indentation from the new wrapper.
Tests
tests/legend-placement.test.tsx asserts the overlay legend renders inside the plot (absolute), and the block legend renders outside/above it. Full suite: 30 passing. Registry regenerated with npm run build:registry (r/core.json).
Summary by Comp AI
No blocking issues found.
Written for commit 8cd45ee. New commits will trigger a re-review. Generated by Comp AI.
Activity
5✅ Comp AI code review complete — no issues found.
Reviewed commit 8cd45ee.
Posted by Comp AI Code Reviews.
No blocking issues found across the changed files.
Posted by Comp AI Code Reviews.
passed — nothing tripped. good to merge.