Skip to content

Commit 3a7497c

Browse files
Lendemormasenf
authored andcommitted
enable css props via wrapperStyle for recharts components (#4447)
1 parent 77594bd commit 3a7497c

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

reflex/components/recharts/recharts.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,15 @@
33
from typing import Dict, Literal
44

55
from reflex.components.component import Component, MemoizationLeaf, NoSSRComponent
6-
from reflex.utils import console
76

87

98
class Recharts(Component):
109
"""A component that wraps a recharts lib."""
1110

1211
library = "[email protected]"
1312

14-
def render(self) -> Dict:
15-
"""Render the tag.
16-
17-
Returns:
18-
The rendered tag.
19-
"""
20-
tag = super().render()
21-
if any(p.startswith("css") for p in tag["props"]):
22-
console.warn(
23-
f"CSS props do not work for {self.__class__.__name__}. Consult docs to style it with its own prop."
24-
)
25-
tag["props"] = [p for p in tag["props"] if not p.startswith("css")]
26-
return tag
13+
def _get_style(self) -> Dict:
14+
return {"wrapperStyle": self.style}
2715

2816

2917
class RechartsCharts(NoSSRComponent, MemoizationLeaf):

reflex/components/recharts/recharts.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ from reflex.style import Style
1111
from reflex.vars.base import Var
1212

1313
class Recharts(Component):
14-
def render(self) -> Dict: ...
1514
@overload
1615
@classmethod
1716
def create( # type: ignore

0 commit comments

Comments
 (0)