Skip to content

Commit d686290

Browse files
authored
fix(material/checkbox): set display on host node (#20961)
Currently the host nodes are `display: inline` by default which doesn't allow for things like `margin` and `width` to be set. These changes switch to `inline-block` which is a bit more flexible. Fixes #20954.
1 parent e303245 commit d686290

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/material-experimental/mdc-checkbox/checkbox.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
@include mdc-form-field-core-styles($query: $mat-base-styles-query);
1010

1111
.mat-mdc-checkbox {
12+
// The host node defaults to `diplay: inline` so
13+
// we have to change it in order for margins to work.
14+
display: inline-block;
15+
1216
// The MDC checkbox styles related to the hover state are intertwined with the MDC ripple styles.
1317
// We currently don't use the MDC ripple due to size concerns, therefore we need to add some
1418
// additional styles to restore the hover state.

src/material/checkbox/checkbox.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * $mat-checkbox-size !default;
177177
.mat-checkbox {
178178
@include mat-private-animation-noop();
179179

180+
// The host node defaults to `diplay: inline` so
181+
// we have to change it in order for margins to work.
182+
display: inline-block;
183+
180184
// Animation
181185
transition: background $swift-ease-out-duration $swift-ease-out-timing-function,
182186
mat-elevation-transition-property-value();

0 commit comments

Comments
 (0)