From 4f9a75b390c1b48e8b527c8f965dbd7def8af8dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= <thomas.brandeho@gmail.com>
Date: Thu, 11 Jul 2024 19:34:39 +0200
Subject: [PATCH] add warning when using css props on recharts (#3651)

---
 reflex/components/recharts/recharts.py  | 17 ++++++++++++++++-
 reflex/components/recharts/recharts.pyi |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/reflex/components/recharts/recharts.py b/reflex/components/recharts/recharts.py
index 2731f8024..adb7bfdf9 100644
--- a/reflex/components/recharts/recharts.py
+++ b/reflex/components/recharts/recharts.py
@@ -1,8 +1,9 @@
 """A component that wraps a recharts lib."""
 
-from typing import Literal
+from typing import Dict, Literal
 
 from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
+from reflex.utils import console
 
 
 class Recharts(Component):
@@ -10,6 +11,20 @@ class Recharts(Component):
 
     library = "recharts@2.12.7"
 
+    def render(self) -> Dict:
+        """Render the tag.
+
+        Returns:
+            The rendered tag.
+        """
+        tag = super().render()
+        if any(p.startswith("css") for p in tag["props"]):
+            console.warn(
+                f"CSS props do not work for {self.__class__.__name__}. Consult docs to style it with its own prop."
+            )
+        tag["props"] = [p for p in tag["props"] if not p.startswith("css")]
+        return tag
+
 
 class RechartsCharts(NoSSRComponent, MemoizationLeaf):
     """A component that wraps a recharts lib."""
diff --git a/reflex/components/recharts/recharts.pyi b/reflex/components/recharts/recharts.pyi
index fc57dd201..409285eb5 100644
--- a/reflex/components/recharts/recharts.pyi
+++ b/reflex/components/recharts/recharts.pyi
@@ -11,6 +11,7 @@ from reflex.style import Style
 from reflex.vars import BaseVar, Var
 
 class Recharts(Component):
+    def render(self) -> Dict: ...
     @overload
     @classmethod
     def create(  # type: ignore