Describe the Features
checkbox_group.root and checkbox_cards.root both wrap the same internal
CheckboxGroupPrimitive.Root (checkbox-group.primitive.tsx in @radix-ui/themes), whose real
prop surface is value, defaultValue, onValueChange, disabled, required, name,
asChild, orientation, dir, and loop. radio_group.root/radio_cards.root already expose
essentially all of these for their own analogous underlying primitive -- but the checkbox side is
missing most of them:
checkbox_group.root currently exposes only default_value and name. Missing: value (so it
can't be used as a controlled component at all), on_value_change, disabled, required,
as_child, orientation, dir, loop.
checkbox_cards.root exposes none of the form-control props -- not even name, disabled,
value, or default_value.
checkbox_cards.item has no declared props whatsoever, so a checkbox card can't even be given a
value -- it's currently unusable for real form submission.
checkbox_group.item/checkbox_cards.item are also missing required, which
radio_group.item/radio_cards.item already have.
One concrete, currently-impossible use case: a controlled multi-select checkbox group
(value=State.selected, on_value_change=State.set_selected) -- rx.radio_group supports the
controlled-value equivalent today, rx.checkbox_group does not.
Separately, CheckboxCardsRoot was never marked _is_form_control = True, so unlike
checkbox_group/radio_group/radio_cards/select/switch/both sliders (see
packages/reflex-components-radix/CHANGELOG.md's note on #6301), a checkbox_cards.root's name
is never picked up when a form validates its fields against a TypedDict-annotated on_submit
handler. That PR's changelog entry lists every other form control except checkbox cards -- this
looks like it was simply skipped at the time because checkbox_cards.root had no name/value
prop yet to report.
Why are you requesting this feature?
Found while fixing a related rx.form bug (a multi-value FormData submit issue) and noticing
checkbox_group/checkbox_cards are the only two form controls in this package that can't be used
as controlled components or participate in typed form validation, even though their direct sibling
components (radio_group, radio_cards) already support exactly this.
What is your proposed implementation for this feature?
Add the missing props directly, matching radio_group.root/radio_cards.root's existing field
declarations for the equivalent primitive props: value, on_value_change
(EventHandler[passthrough_event_spec(list[str])], matching the existing
toggle_group/accordion precedent for a list-valued onValueChange), disabled, required,
as_child, orientation, dir, loop on both roots; name/default_value additionally on
checkbox_cards.root; required on both item classes; value/disabled additionally on
checkbox_cards.item. Also sets CheckboxCardsRoot._is_form_control = True. I've already
implemented, tested, and verified all of this -- happy to open a PR immediately if the direction is
welcome.
Describe the Features
checkbox_group.rootandcheckbox_cards.rootboth wrap the same internalCheckboxGroupPrimitive.Root(checkbox-group.primitive.tsxin@radix-ui/themes), whose realprop surface is
value,defaultValue,onValueChange,disabled,required,name,asChild,orientation,dir, andloop.radio_group.root/radio_cards.rootalready exposeessentially all of these for their own analogous underlying primitive -- but the checkbox side is
missing most of them:
checkbox_group.rootcurrently exposes onlydefault_valueandname. Missing:value(so itcan't be used as a controlled component at all),
on_value_change,disabled,required,as_child,orientation,dir,loop.checkbox_cards.rootexposes none of the form-control props -- not evenname,disabled,value, ordefault_value.checkbox_cards.itemhas no declared props whatsoever, so a checkbox card can't even be given avalue-- it's currently unusable for real form submission.checkbox_group.item/checkbox_cards.itemare also missingrequired, whichradio_group.item/radio_cards.itemalready have.One concrete, currently-impossible use case: a controlled multi-select checkbox group
(
value=State.selected, on_value_change=State.set_selected) --rx.radio_groupsupports thecontrolled-value equivalent today,
rx.checkbox_groupdoes not.Separately,
CheckboxCardsRootwas never marked_is_form_control = True, so unlikecheckbox_group/radio_group/radio_cards/select/switch/both sliders (seepackages/reflex-components-radix/CHANGELOG.md's note on #6301), acheckbox_cards.root'snameis never picked up when a form validates its fields against a
TypedDict-annotatedon_submithandler. That PR's changelog entry lists every other form control except checkbox cards -- this
looks like it was simply skipped at the time because
checkbox_cards.roothad noname/valueprop yet to report.
Why are you requesting this feature?
Found while fixing a related
rx.formbug (a multi-valueFormDatasubmit issue) and noticingcheckbox_group/checkbox_cardsare the only two form controls in this package that can't be usedas controlled components or participate in typed form validation, even though their direct sibling
components (
radio_group,radio_cards) already support exactly this.What is your proposed implementation for this feature?
Add the missing props directly, matching
radio_group.root/radio_cards.root's existing fielddeclarations for the equivalent primitive props:
value,on_value_change(
EventHandler[passthrough_event_spec(list[str])], matching the existingtoggle_group/accordionprecedent for a list-valuedonValueChange),disabled,required,as_child,orientation,dir,loopon both roots;name/default_valueadditionally oncheckbox_cards.root;requiredon both item classes;value/disabledadditionally oncheckbox_cards.item. Also setsCheckboxCardsRoot._is_form_control = True. I've alreadyimplemented, tested, and verified all of this -- happy to open a PR immediately if the direction is
welcome.