feat(checkbox): default size and appearance#29236
Conversation
sean-perkins
left a comment
There was a problem hiding this comment.
Feedback/notes for reviewers.
The key pieces to review here are:
- Did I make any silly mistakes in the code.
- Does the checkbox render at 24px by default
Follow-up PRs will address the other sizes, shapes, states (focus/active/disabled), etc.
| $checkbox-ionic-size: 24px !default; | ||
|
|
||
| /// @prop - The background color of the checkbox icon when the checkbox is unchecked | ||
| $checkbox-ionic-icon-background-color-off: $background-color-step-450 !default; |
There was a problem hiding this comment.
This border color is based from the Figma design color of #9A9A9A.
Note: OS can customize the color palette to actually apply their desired color.
$background-color-step-450 evaluates to #8C8C8C and provides a good visual default to an existing Ionic Framework variable.
There was a problem hiding this comment.
I'm ok with updating to step-400 👍 I had looked at both and simply committed. Without the design tokens connected from Figma, we will have to pick what is reasonably close & adjust as that architecture exists.
|
|
||
| /// @prop - The border radius of the checkbox icon. | ||
| /// With a default size of 24px, the border radius is calculated as 24px / 6 = 4px | ||
| $checkbox-ionic-border-radius: calc(var(--size) / 6) !default; |
There was a problem hiding this comment.
The original border radius value in the linked PR was incorrect. It was copied from Material Design, but in the Figma file we can see the desired border radius is:
- When the checkbox is
24pxthe border radius is4px - When the checkbox is small (
16px) the border radius is2px.
With the current calculation, we are close enough:
- When the checkbox is
24pxthe border radius is4px - When the checkbox is small (
16px) the border radius is2.667px
OS can target the --border-radius if they need to hard-set the border radius to 2px for the small size.
This approach of basing the border radius on the size, provides a better visual appearance for when a developer customizes the size beyond the default sizes.
There was a problem hiding this comment.
If we wanted to get it to match on both small and large we could do this:
| $checkbox-ionic-border-radius: calc(var(--size) / 6) !default; | |
| $checkbox-ionic-border-radius: calc(var(--size) / 4 - 2px) !default; |
but that's optional here.
Discussed with Liam & Brandy, we are going to simplify these names since they aren't specific to the icon.
|
|
||
| :host { | ||
| // Border | ||
| --border-radius: #{$checkbox-ionic-border-radius}; |
There was a problem hiding this comment.
Discussed internally with Liam & Brandy. You will notice the naming convention here is different than iOS/MD. We've decided to remove the -icon from the name. It didn't make sense.
We left iOS/MD alone, this only applies to the ionic theme.
brandyscarney
left a comment
There was a problem hiding this comment.
Looks good, added an optional change to make the border radius match the design more closely.

Issue number: N/A
What is the current behavior?
What is the new behavior?
"ionic"theme.Does this introduce a breaking change?
Other information
Split from #29213. I will note differences in comments on this PR.