Hello everyone. I was playing around with Iced and I noticed the Checkbox widget has a label by default. In my opinion, this shouldn’t be the case, for several reasons.
Sometimes the label is somewhere else in the UI: in my case, for example, I was using a label on top of a column of Checkboxes and the Checkboxes are somewhat misaligned when using “” as label.
In other use cases, one might want the label to be on the left of the Checkbox, rather than on the right.
Long story short, I think the default Checkbox should be exactly just the Checkbox.
If I’m not mistaken, this is also what Flutter does.
If this is fine, I could try opening a PR when I have some time.
I disagree. I don’t know if this is the case already with Iced’s checkboxes, but in most GUIs the label of a checkbox is also part of the interactive area of the component, meaning that tapping/clicking the label is the same as tapping/clicking the checkbox.
Yeah true, but that could be composed with a checkbox + text. Or it could be an additional widget, as Flutter does. I think the basic Checkbox should be without a label, then in the additional widgets crate there could be different variations. This would give flexibility to those who want it, and more variety to those who don’t.
But you already get that flexibility by using an empty string as a label, right? The misalignment part does sound weird though, if they all have the same label I don’t see why they wouldn’t align.
Yes, of course, it’s not an issue either way, just a matter of design, but it boils down to preference in the end, since some other GUI frameworks include a label, some others don’t.
I think the misalignment was a mistake on my end, by the way.
I had also opened this discussion after I found this PR and I thought it was something that needed to be worked on.
I can’t say I disagree now. As long as there is way for a label to be “connected” to the checkbox to provide the functionality I mentioned earlier, having it separate would indeed provide more flexibility in terms of layout. In any case I don’t make any decisions here, just commenting
Well, from an API design perspective, it sort of bugs me to use an empty string for something I don’t need, even if it’s not the end of the world .
Anyway, thanks to your comment I went to look around and saw that some other GUI frameworks do ask for a label in the default Checkbox, so thanks for the exchange.
In the end I think both widgets should be supported, I like the Flutter API a lot in this case. But let’s see what everyone else thinks.