Problem to solve
I'm working on a very form heavy app that's trying to improve information density by making selects with only a few options Checkboxes and Radio Buttons. While implementing the designs the VRadioGroup works flawlessly, but when it comes to Checkboxes there's a lot of gotchas to contend with.
Up front the ones I've encountered are:
- the
VCheckbox label height is aligned with the general input height, so simply stacking them or flexing to inline them causes them not to visually match the radio buttons
VCheckboxBtn is the obvious next choice
- It has the benefit of matching the
VRadio heights (being that they're both VSelectionControl elements)
- but they're a bit "non-standard" in that you wouldn't think to reach for them which isn't a deal breaker on it's own
- Grouping them requires some degree of custom wiring that
VRadioGroup handles for its children
- Accessible
label, messages, and grouping via role (this is important for my company)
- VInput trappings (messages, etc.)
- Style handling (e.g. inline, and all the
VSelectionControlGroup props generally)
There's more than a few ways to wire things and they all have their own room for introducing errors and differences over time and any lower level solutions (cloning the VRadioGroup component or using internal APIs) risk needing interventions if there are breaking changes.
Note: I did see #16858 but it's been closed for over a year and I felt I had a more compelling argument to make in terms of why it would be helpful vs. using a workaround.
I also saw #16245 (comment) and considered mentioning it there, but it feels like it's more deserving of its own discussion.
Proposed solution
I naively hope it would be as simple as cloning VRadioGroup, retaining the multiple prop, adding some conditional styling for VCheckbox, and updating defaultsTarget but in my time trying to reverse engineer the component a bit (was thinking of maybe recreating it in a SFC) I'm not super confident in that assessment
Though in writing this feature request I've learned a lot more about the various workarounds, so if it comes down to a documentation update along the lines of "Use VCheckboxBtn in VRadioGroup to group them" I'd be happy with that too, even if it doesn't feel like the pattern would be getting first-class treatment, I can appreciate the maintenance costs associated with that :)
Problem to solve
I'm working on a very form heavy app that's trying to improve information density by making selects with only a few options Checkboxes and Radio Buttons. While implementing the designs the
VRadioGroupworks flawlessly, but when it comes to Checkboxes there's a lot of gotchas to contend with.Up front the ones I've encountered are:
VCheckboxlabel height is aligned with the general input height, so simply stacking them or flexing to inline them causes them not to visually match the radio buttonsVCheckboxBtnis the obvious next choiceVRadioheights (being that they're bothVSelectionControlelements)VRadioGrouphandles for its childrenlabel,messages, and grouping viarole(this is important for my company)VSelectionControlGroupprops generally)There's more than a few ways to wire things and they all have their own room for introducing errors and differences over time and any lower level solutions (cloning the
VRadioGroupcomponent or using internal APIs) risk needing interventions if there are breaking changes.Note: I did see #16858 but it's been closed for over a year and I felt I had a more compelling argument to make in terms of why it would be helpful vs. using a workaround.
I also saw #16245 (comment) and considered mentioning it there, but it feels like it's more deserving of its own discussion.
Proposed solution
I naively hope it would be as simple as cloning
VRadioGroup,retaining themultipleprop, adding some conditional styling forVCheckbox, and updatingdefaultsTargetbut in my time trying to reverse engineer the component a bit (was thinking of maybe recreating it in a SFC) I'm not super confident in that assessmentThough in writing this feature request I've learned a lot more about the various workarounds, so if it comes down to a documentation update along the lines of "Use
VCheckboxBtninVRadioGroupto group them" I'd be happy with that too, even if it doesn't feel like the pattern would be getting first-class treatment, I can appreciate the maintenance costs associated with that :)