Skip to content

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

@tmorehouse

Description

@tmorehouse

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions