feat(combobox): reuse CheckboxGroup for required ComboboxCheckbox
Result
What
ComboboxCheckbox now carries the same ruby-ui--checkbox-group and ruby-ui--form-field wiring that Checkbox already has. A multi-select combobox can therefore reuse the existing CheckboxGroup controller to enforce "at least one option required" — no new controller and no combobox-side validation logic.
Usage mirrors a regular checkbox group: wrap the options in CheckboxGroup(data_required: true). While nothing is checked, the group keeps every option required (so the browser blocks submission); once any option is checked, the constraint is lifted.
Why
There was no client-side "require at least one" for a checkbox combobox. Rather than reimplement group validity inside the combobox controller, this wires ComboboxCheckbox to the controller that already solves it for Checkbox, keeping a single source of truth.
Changes
ComboboxCheckbox: addruby_ui__checkbox_group_target: "checkbox",ruby_ui__form_field_target: "input", and thechange->ruby-ui--checkbox-group#onChange/change->ruby-ui--form-field#onInput/invalid->ruby-ui--form-field#onInvalidactions (mirrorsCheckbox).- Docs: new "Required" example wrapping the options in
CheckboxGroup(data_required: true). mcp/data/registry.jsonrebuilt; gem test added.
Note on "Select all"
ComboboxToggleAllCheckbox sets checked programmatically, which does not emit a change event, so select-all does not re-run CheckboxGroup#onChange. This is harmless for submission: select-all only produces a uniform state — all checked (valid, since each checked option satisfies its own required) or all unchecked (correctly blocked). The only residue is that an already-visible FormFieldError message is not refreshed by the select-all action itself; it clears on the next option interaction. Left as-is (out of scope).
Test instructions
bin/devindocs/, open/docs/combobox, scroll to the Required example.- Open the combobox and submit the form without checking anything → submission is blocked and
FormFieldErrorshows "Pick at least one option". - Check any option → the error clears and the form submits.
- Check one, then uncheck it → the required constraint is reapplied and submission is blocked again.
Verified locally: with nothing checked form.checkValidity() is false; after checking one option it is true; the FormFieldError toggles accordingly. Gem suite green, StandardRB clean.