Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support control/label sizing for custom radios and checkboxes/switches #27803

Closed
tmorehouse opened this issue Dec 7, 2018 · 4 comments
Closed

Comments

@tmorehouse
Copy link
Contributor

Currently it is not possible to (properly) size custom radios and checkboxes, as one can do with other form-controls.

One can add .col-form-label-sm or .col-form-label-lg to the custom checkbox/radio markup to scale the label accordingly, but the indicator icon does not scale with the change in label font size.

image

One could switch the units of the ::before and ::after width/height/top, and the left gutter padding to em units instead of rem units (as these pseudo elements inherit the base font-size from their parent element - the label). This makes the indicators scale nicely when the font-size of the label scales, without needing additional CSS rules for the indicators. All that would be needed would be new classes .custom-control-sm and .custom-control-lg (as an alternative to using .col-form-label-sm and .col-form-label-lg) to control the font-size (and possibly top/bottom padding of the label text)

Example (switching pseudo element units to em):

image

@tmorehouse
Copy link
Contributor Author

This trick would also work well with the new custom-switch component.

@tmorehouse tmorehouse changed the title Support control/label sizing for custom radios and checkboxes Support control/label sizing for custom radios and checkboxes/switches Dec 15, 2018
@adaniello
Copy link

I'm agree. This is the same point of my old issue #27527 closed by Mark.
Maybe it's time to clarify a way for custom controls sizing, considering also the missing of sizing for new "switch"control.

@mdo
Copy link
Member

mdo commented Dec 29, 2018

We can move to em units and make them easily scale. We’ll likely do that in v5 though instead of the v4.3 release to keep things behaving as expected.

@mdo
Copy link
Member

mdo commented Jul 13, 2019

This was added in #28450 with the major form rewrite to consolidate native and custom form controls from v4. Closing as fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants