Skip to content

Commit f51f3d3

Browse files
authored
fix(radix): drop as_child from radio_cards root and item (#7593)
Radix Themes omits asChild from RadioCards.Root and forces asChild={false} on RadioCards.Item. On the root, as_child=True turned the radio group primitive into a Slot inside Grid asChild, crashing the page with several cards or dropping the container with one. On the item the prop did nothing. Remove the field from both, matching checkbox_cards. Signed-off-by: vjymisal0 <misalvijay153@gmail.com>
1 parent 5ae5dcd commit f51f3d3

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the `as_child` prop from `rx.radio_cards.root` and `rx.radio_cards.item`. Radix Themes does not accept `asChild` on either component: on the root it crashed the page or dropped the grid container, and on the item it did nothing.

‎packages/reflex-components-radix/src/reflex_components_radix/themes/components/radio_cards.py‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ class RadioCardsRoot(RadixThemesComponent):
1717
tag = "RadioCards.Root"
1818
_is_form_control = True
1919

20-
as_child: Var[bool] = field(
21-
doc="Change the default rendered element for the one passed as a child, merging their props and behavior."
22-
)
23-
2420
size: Var[Responsive[Literal["1", "2", "3"]]] = field(
2521
doc='The size of the checkbox cards: "1" | "2" | "3"'
2622
)
@@ -83,10 +79,6 @@ class RadioCardsItem(RadixThemesComponent):
8379

8480
tag = "RadioCards.Item"
8581

86-
as_child: Var[bool] = field(
87-
doc="Change the default rendered element for the one passed as a child, merging their props and behavior."
88-
)
89-
9082
value: Var[str] = field(doc="The value given as data when submitted with a name.")
9183

9284
disabled: Var[bool] = field(

‎pyi_hashes.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/popover.pyi": "f0e2ce71c899e7029e0dffa9a88df1d2",
7777
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/progress.pyi": "e90d1f64301e17ca54a1edf2878bea9f",
7878
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/radio.pyi": "e14c994517828f84d9fc9f85501eee7a",
79-
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/radio_cards.pyi": "45470676b80c15d722b142c27521a64f",
79+
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/radio_cards.pyi": "441bfcd3991c42967d6dacdd3ef11995",
8080
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/radio_group.pyi": "e933b49dab8027e1829cdd90ba99cc5d",
8181
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/scroll_area.pyi": "b83dd81a37aaad75dcb6341e94e6d41f",
8282
"packages/reflex-components-radix/src/reflex_components_radix/themes/components/segmented_control.pyi": "dfdde032961bda7905ef4256eb19152d",
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import pytest
2+
from reflex_components_radix.themes.components.radio_cards import radio_cards
3+
4+
5+
@pytest.mark.parametrize(
6+
"component",
7+
[
8+
lambda: radio_cards.root(radio_cards.item("One", value="one"), as_child=True),
9+
lambda: radio_cards.item("One", value="one", as_child=True),
10+
],
11+
ids=["root", "item"],
12+
)
13+
def test_radio_cards_does_not_forward_as_child(component):
14+
"""Radix Themes omits asChild from RadioCards, so it is never rendered as a prop.
15+
16+
Args:
17+
component: Builds the radio cards component under test.
18+
"""
19+
assert not any(
20+
prop.startswith("asChild:") for prop in component().render()["props"]
21+
)

0 commit comments

Comments
 (0)