fix(radix): drop as_child from radio_cards root and item

Merged
VJ
6d ago
+23-9

Summary

rx.radio_cards.root and rx.radio_cards.item declared an as_child prop that Radix Themes does not accept:

  • RadioCards.Root props are ComponentPropsWithout<typeof RadioGroupPrimitive.Root, 'asChild' | 'color' | 'defaultChecked'>, and the root wraps the primitive in <Grid asChild>. Forwarding asChild turned the primitive into a Slot, so the page crashed with several cards (Primitive.div failed to slot onto its children) or lost its container with one.
  • RadioCards.Item renders <RadioGroupPrimitive.Item {...props} asChild={false} />, so the prop did nothing.

This removes the field from both components, the same way #7345 left it off checkbox_cards / checkbox_group. Passing as_child now falls through like any other undeclared prop instead of reaching Radix.

Changes

  • radio_cards.py: remove as_child from RadioCardsRoot and RadioCardsItem.
  • pyi_hashes.json: regenerated radio_cards.pyi hash.
  • tests/units/reflex_components_radix/themes/components/test_radio_cards.py: regression test that neither component renders an asChild prop.
  • packages/reflex-components-radix/news/7555.bugfix.md: news fragment.

Verification

  • New test fails on main (both root and item render asChild:true) and passes with the fix.
  • Default usage without as_child renders unchanged (columns, defaultValue, etc.).
  • uv run pytest tests/units/components tests/units/reflex_components_radix tests/units/compiler: 4594 passed, 1 skipped.
  • ruff check, ruff format --check, and pyright on the touched files: clean.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Closes #7555