Skip to content

Commit 0c35a29

Browse files
authored
add g svg element (#5360)
1 parent 4576fcd commit 0c35a29

4 files changed

Lines changed: 35 additions & 2 deletions

File tree

pyi_hashes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"reflex/components/datadisplay/shiki_code_block.pyi": "ac16fd6c23eef7ce0185437ecf2d529d",
2828
"reflex/components/el/__init__.pyi": "09042a2db5e0637e99b5173430600522",
2929
"reflex/components/el/element.pyi": "323cfb5d67d8ccb58ac36c7cc7641dc3",
30-
"reflex/components/el/elements/__init__.pyi": "280ed457675f3720e34b560a3f617739",
30+
"reflex/components/el/elements/__init__.pyi": "baeddd04d4d3a82799420b2a6df368f6",
3131
"reflex/components/el/elements/base.pyi": "697cd6716e3b1127b35299435c3d4e69",
3232
"reflex/components/el/elements/forms.pyi": "21d7135b513bac72fd63b44c945932a5",
3333
"reflex/components/el/elements/inline.pyi": "ab31eec758f1cff8a9d51bf0935b9fca",
34-
"reflex/components/el/elements/media.pyi": "ac99654959ed26b7b7d0f3dafa0ea2ab",
34+
"reflex/components/el/elements/media.pyi": "c191a9e00223a97e26a0d6ab99a1919b",
3535
"reflex/components/el/elements/metadata.pyi": "eda94a3283bae6a9b61b4cb1e20c1dbd",
3636
"reflex/components/el/elements/other.pyi": "960bdac0bb9bf6b3cffd241f9b66c0fc",
3737
"reflex/components/el/elements/scripts.pyi": "ac3b8bfbd7777f33fb2c6aa109a5c627",

reflex/components/el/elements/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"text",
7070
"line",
7171
"circle",
72+
"g",
7273
"ellipse",
7374
"rect",
7475
"polygon",

reflex/components/el/elements/media.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,30 @@ class Path(BaseHTML):
484484
d: Var[str | int | float]
485485

486486

487+
class G(BaseHTML):
488+
"""The SVG g component, used to group other SVG elements."""
489+
490+
tag = "g"
491+
492+
# The fill color of the group.
493+
fill: Var[str | Color]
494+
495+
# The fill opacity of the group.
496+
fill_opacity: Var[str | int | float]
497+
498+
# The stroke color of the group.
499+
stroke: Var[str | Color]
500+
501+
# The stroke opacity of the group.
502+
stroke_opacity: Var[str | int | float]
503+
504+
# The stroke width of the group.
505+
stroke_width: Var[str | int | float]
506+
507+
# The transform applied to the group.
508+
transform: Var[str]
509+
510+
487511
class SVG(ComponentNamespace):
488512
"""SVG component namespace."""
489513

@@ -498,6 +522,7 @@ class SVG(ComponentNamespace):
498522
linear_gradient = staticmethod(LinearGradient.create)
499523
radial_gradient = staticmethod(RadialGradient.create)
500524
defs = staticmethod(Defs.create)
525+
g = staticmethod(G.create)
501526
__call__ = staticmethod(Svg.create)
502527

503528

@@ -512,6 +537,7 @@ class SVG(ComponentNamespace):
512537
linear_gradient = LinearGradient.create
513538
radial_gradient = RadialGradient.create
514539
defs = Defs.create
540+
g = G.create
515541
area = Area.create
516542
audio = Audio.create
517543
image = img = Img.create

tests/units/components/el/test_svg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Circle,
33
Defs,
44
Ellipse,
5+
G,
56
Line,
67
LinearGradient,
78
Path,
@@ -72,3 +73,8 @@ def test_text():
7273
def test_stop():
7374
stop = Stop.create().render()
7475
assert stop["name"] == '"stop"'
76+
77+
78+
def test_g():
79+
g = G.create().render()
80+
assert g["name"] == '"g"'

0 commit comments

Comments
 (0)