Skip to content

Add Layer and Rectangle components to Recharts#6729

Open
masenf wants to merge 1 commit into
mainfrom
claude/recharts-layer-rectangle-wrappers-wsq24d
Open

Add Layer and Rectangle components to Recharts#6729
masenf wants to merge 1 commit into
mainfrom
claude/recharts-layer-rectangle-wrappers-wsq24d

Conversation

@masenf

@masenf masenf commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Type of change

  • New feature (non-breaking change which adds functionality)

New Feature Submission

This PR adds two new Recharts components to support constructing custom node elements:

  • Layer: A wrapper around the Recharts Layer component 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

  1. packages/reflex-components-recharts/src/reflex_components_recharts/general.py:

    • Added Layer class with tag "Layer" and alias "RechartsLayer"
    • Added Rectangle class with comprehensive properties:
      • Positioning: x, y
      • Sizing: width, height, radius
      • Styling: fill, fill_opacity, stroke, stroke_width
      • Animation: is_animation_active, is_update_animation_active, animation_begin, animation_duration, animation_easing
    • Exported layer and rectangle factory functions
  2. packages/reflex-components-recharts/src/reflex_components_recharts/__init__.py:

    • Added exports for Layer, layer, Rectangle, and rectangle to the public API
  3. tests/units/components/recharts/test_general.py (new file):

    • Added unit tests covering:
      • Basic Layer rendering
      • Layer with children (nesting Rectangle)
      • Basic Rectangle rendering
      • Rectangle with all supported properties
  4. packages/reflex-components-recharts/news/+layer_rectangle.feature.md (new file):

    • Added changelog entry documenting the new components

Testing

  • Added comprehensive unit tests in test_general.py covering component creation, rendering, and property handling
  • Tests verify correct component names, child nesting, and property serialization

Checklist

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?
  • Have you written new tests for your core changes, as applicable?
  • pyi_hashes.json updated for modified .pyi files

https://claude.ai/code/session_01XqtAPUo84EBNq6c8Ext3mC

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
@masenf masenf requested a review from a team as a code owner July 9, 2026 22:36
@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Recharts wrappers for custom SVG node construction. The main changes are:

  • New Layer and Rectangle components in the Recharts general module.
  • Package-root exports for the new classes and factory functions.
  • Unit tests for rendering, nesting, and Rectangle prop serialization.
  • Updated stub hashes and a feature news entry.

Confidence Score: 5/5

This looks safe to merge after a small API-doc cleanup.

  • The new exports match the added component definitions.
  • The wrapper props follow the existing Recharts serialization pattern.
  • The only follow-up is a misleading Rectangle animation default in the doc text.

packages/reflex-components-recharts/src/reflex_components_recharts/general.py

Important Files Changed

Filename Overview
packages/reflex-components-recharts/src/reflex_components_recharts/general.py Adds Layer and Rectangle wrappers plus factories; one Rectangle animation default docstring does not match omitted-prop behavior.
packages/reflex-components-recharts/src/reflex_components_recharts/init.py Adds the new classes and factories to the package lazy-export map using the established Recharts pattern.
tests/units/components/recharts/test_general.py Adds tests for package-root imports, rendered names, child nesting, and Rectangle prop serialization.
pyi_hashes.json Updates generated stub hashes for the changed Recharts package surfaces.
packages/reflex-components-recharts/news/+layer_rectangle.feature.md Adds a short feature news entry for the new Layer and Rectangle wrappers.

Reviews (1): Last reviewed commit: "feat(recharts): add Layer and Rectangle ..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Jul 9, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing claude/recharts-layer-rectangle-wrappers-wsq24d (7a5ebe8) with main (948c619)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants