Skip to content

Commit 053e6d8

Browse files
asynclizcopybara-github
authored andcommitted
chore(labs): fix checkbox & radio icon placement and customization
PiperOrigin-RevId: 901275472
1 parent 7311396 commit 053e6d8

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

labs/gb/components/checkbox/checkbox.scss

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,27 @@
6464
height: 48px;
6565
background-image: none;
6666
outline: none;
67+
margin: 0;
68+
--icon: 'check';
69+
70+
&:is(:indeterminate, .indeterminate)::before {
71+
--icon: 'remove';
72+
}
6773

6874
&::before {
69-
content: '';
75+
content: var(--icon);
76+
display: inline-flex;
77+
align-items: center;
78+
justify-content: center;
7079
box-sizing: border-box;
80+
overflow: hidden;
81+
aspect-ratio: 1;
7182
width: var(--container-size);
72-
height: var(--container-size);
7383
background: var(--container-color);
7484
border-radius: var(--container-shape);
7585
border: var(--outline-width) solid var(--outline-color);
7686
color: var(--icon-color);
77-
font-family: var(--md-icon-font);
78-
font-size: var(--icon-size);
79-
line-height: 1;
87+
font: var(--icon-size) / 1 var(--md-icon-font);
8088
}
8189

8290
&::after {
@@ -92,14 +100,6 @@
92100
transition: var(--ripple-transition);
93101
animation: var(--ripple-animation), var(--focus-ring-animation);
94102
}
95-
96-
&:is(:checked, .checked)::before {
97-
content: 'check';
98-
}
99-
100-
&:is(:indeterminate, .indeterminate)::before {
101-
content: 'remove';
102-
}
103103
}
104104
}
105105
}

labs/gb/components/radio/radio.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,17 @@
4444
height: 48px;
4545
background-image: none;
4646
outline: none;
47+
--icon: 'radio_button_unchecked';
4748

4849
&::before {
49-
content: 'radio_button_unchecked';
50+
content: var(--icon);
5051
color: var(--icon-color);
51-
font-family: var(--md-icon-font);
52-
font-size: var(--icon-size);
53-
line-height: 1;
52+
font: var(--icon-size) / 1 var(--md-icon-font);
5453
width: var(--icon-size);
5554
aspect-ratio: 1;
5655
}
5756
&:is(:checked, .checked)::before {
58-
content: 'radio_button_checked';
57+
--icon: 'radio_button_checked';
5958
}
6059
&::after {
6160
content: '';

0 commit comments

Comments
 (0)