Add Layer and Rectangle components to Recharts - #6729
Conversation
Wrap the Recharts Layer (SVG <g> grouping) and Rectangle (SVG shape) components, which are used as building blocks for constructing custom node elements. Exposed as rx.recharts.layer and rx.recharts.rectangle. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqtAPUo84EBNq6c8Ext3mC
Greptile SummaryThis PR adds Layer and Rectangle wrappers for Recharts. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| packages/reflex-components-recharts/src/reflex_components_recharts/general.py | Adds the new SVG-style Recharts base wrapper plus Layer, Rectangle, and their factory aliases. |
| packages/reflex-components-recharts/src/reflex_components_recharts/charts.py | Allows Layer and Rectangle as children for the supported chart wrappers. |
| packages/reflex-components-recharts/src/reflex_components_recharts/init.py | Exposes the new Recharts components through the package lazy export map. |
| tests/units/components/recharts/test_general.py | Adds tests for the new components, nesting, serialized props, and style passthrough. |
| tests/units/components/recharts/test_charts.py | Adds chart-level tests that verify the new components are accepted as children. |
Reviews (3): Last reviewed commit: "fix(recharts): allow Layer/Rectangle in ..." | Re-trigger Greptile
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a5ebe831e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Add Layer and Rectangle to every chart's _valid_children so they can be used as chart overlays (recharts renders them inside the chart surface). Route their style prop through the default Component styling instead of the Recharts wrapperStyle remap, which only container components understand and silently dropped styles on plain SVG elements.
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Type of change
New Feature Submission
This PR adds two new Recharts components to support constructing custom node elements:
Layer: A wrapper around the RechartsLayercomponent that renders an SVG<g>element for grouping other SVG elements.Rectangle: A shape component for rendering rectangles with full support for positioning, sizing, styling, and animation properties.Changes
packages/reflex-components-recharts/src/reflex_components_recharts/general.py:Layerclass with tag"Layer"and alias"RechartsLayer"Rectangleclass with comprehensive properties:x,ywidth,height,radiusfill,fill_opacity,stroke,stroke_widthis_animation_active,is_update_animation_active,animation_begin,animation_duration,animation_easinglayerandrectanglefactory functionspackages/reflex-components-recharts/src/reflex_components_recharts/__init__.py:Layer,layer,Rectangle, andrectangleto the public APItests/units/components/recharts/test_general.py(new file):LayerrenderingLayerwith children (nestingRectangle)RectanglerenderingRectanglewith all supported propertiespackages/reflex-components-recharts/news/+layer_rectangle.feature.md(new file):Testing
test_general.pycovering component creation, rendering, and property handlingChecklist
pyi_hashes.jsonupdated for modified.pyifileshttps://claude.ai/code/session_01XqtAPUo84EBNq6c8Ext3mC