Skip to content

Commit d36e380

Browse files
committed
fixup! fix(material-experimental/mdc-button): fix positioning of icons in text buttons
1 parent bd34f66 commit d36e380

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

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

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010
.mat-mdc-button, .mat-mdc-unelevated-button, .mat-mdc-raised-button, .mat-mdc-outlined-button {
1111
@include _mat-button-interactive();
1212
@include _mat-button-disabled();
13+
14+
// MDC expects button icons to contain this HTML content:
15+
// ```html
16+
// <span class="mdc-button__icon material-icons">favorite</span>
17+
// ```
18+
// However, Angular Material expects a `mat-icon` instead. The following
19+
// will extend the `mdc-button__icon` styling to the mat icon. Note that
20+
// the extended styles inherently only match icons that nest themselves in
21+
// a parent `mdc-button`.
22+
//
23+
// TODO(mmalerba): Have MDC create a mixin for this so we don't have to rely on extending their
24+
// class.
25+
.mat-icon {
26+
@extend .mdc-button__icon;
27+
}
1328
}
1429

1530
// Add an outline to make buttons more visible in high contrast mode. Stroked buttons and FABs
@@ -45,15 +60,3 @@
4560
right: -$mdc-button-outlined-border-width;
4661
border: none;
4762
}
48-
49-
// MDC expects button icons to contain this HTML content:
50-
// ```html
51-
// <span class="mdc-button__icon material-icons">favorite</span>
52-
// ```
53-
// However, Angular Material expects a `mat-icon` instead. The following
54-
// will extend the `mdc-button__icon` styling to the mat icon. Note that
55-
// the extended styles inherently only match icons that nest themselves in
56-
// a parent `mdc-button`.
57-
.mat-icon {
58-
@extend .mdc-button__icon;
59-
}

0 commit comments

Comments
 (0)