diff --git a/src/material/button/_button-theme.scss b/src/material/button/_button-theme.scss index 8ab5f7c48c86..5c5e2ccd644b 100644 --- a/src/material/button/_button-theme.scss +++ b/src/material/button/_button-theme.scss @@ -206,10 +206,14 @@ @mixin density($theme) { $density-scale: theming.clamp-density(inspection.get-theme-density($theme), -3); + + .mat-mdc-unelevated-button { + $density-tokens: tokens-mdc-button-filled.get-density-tokens($theme); + @include mdc-button-filled-theme.theme($density-tokens); + } .mat-mdc-button, .mat-mdc-raised-button, - .mat-mdc-unelevated-button, .mat-mdc-outlined-button { // Use `mat-mdc-button-base` to increase the specificity over the button's structural styles. &.mat-mdc-button-base { diff --git a/src/material/core/tokens/m2/mdc/_button-filled.scss b/src/material/core/tokens/m2/mdc/_button-filled.scss index 3a9994384bda..1294cf0ad920 100644 --- a/src/material/core/tokens/m2/mdc/_button-filled.scss +++ b/src/material/core/tokens/m2/mdc/_button-filled.scss @@ -1,7 +1,9 @@ +@use 'sass:map'; @use '../../token-utils'; @use '../../../mdc-helpers/mdc-helpers'; @use '../../../style/sass-utils'; @use '../../../theming/inspection'; +@use '../../../theming/theming'; // The prefix used to generate the fully qualified name for tokens in this file. $prefix: (mdc, button-filled); @@ -15,7 +17,6 @@ $prefix: (mdc, button-filled); @function get-unthemable-tokens() { @return ( container-elevation: 0, - container-height: 36px, container-shape: 4px, disabled-container-elevation: 0, focus-container-elevation: 0, @@ -77,7 +78,20 @@ $prefix: (mdc, button-filled); // Tokens that can be configured through Angular Material's density theming API. @function get-density-tokens($theme) { - @return (); + $scale: theming.clamp-density(inspection.get-theme-density($theme), -3); + + @return ( + container-height: + map.get( + ( + 0: 36px, + -1: 32px, + -2: 28px, + -3: 24px, + ), + $scale + ) + ); } // Combines the tokens generated by the above functions into a single map with placeholder values.