Skip to content

Commit 9acab86

Browse files
devversionjelbourn
authored andcommitted
fix(checkbox): label content should not wrap (#6674)
* Similar as for the radio component, the checkbox label content should not wrap if it exceeds the boundaries of the parent element. This ensures that we have consistent behavior across all selection controls. * Fixes that the radio container (circle) shrinks if the label content is exceeding the boundaries and wrapping is enabled (developers may overwrite CSS to enable wrapping) Closes #6671
1 parent b678119 commit 9acab86

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/lib/checkbox/checkbox.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
193193
align-items: baseline;
194194
vertical-align: middle;
195195
display: inline-flex;
196+
white-space: nowrap;
196197
}
197198

198199
.mat-checkbox-inner-container {

src/lib/radio/radio.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@ $mat-radio-ripple-size: $mat-radio-size * 0.75;
2424
.mat-radio-container {
2525
box-sizing: border-box;
2626
display: inline-block;
27-
height: $mat-radio-size;
2827
position: relative;
2928
width: $mat-radio-size;
29+
height: $mat-radio-size;
30+
// The radio container is inside of a inline-flex element and may shrink if the label
31+
// is wide and text-wrapping is enabled.
32+
flex-shrink: 0;
3033
}
3134

3235
// The outer circle for the radio, always present.

0 commit comments

Comments
 (0)