When it comes to mat-icons, they are essentially font images. To adjust their size, you will need to overwrite the font size of the mat-icon class.
For Angular Material 8 and above, include the following code in the component's stylesheet:
.mat-icon{
font-size:48px !important; //increase the size to 48px from the default 24px
width:48px; //remember to adjust the width
height:48px; //and/or height accordingly
}
See Demo
Alternatively, you can directly modify it in the HTML like so:
<mat-icon style="font-size:48px">mail</mat-icon>
For older versions, you still have the option to use ::ng-deep to target that specific class deep within the host element. Adjusting the width and height is also necessary to maintain proportionality with the backdrop size.
HTML:
<button mat-button>
<mat-icon class="material-icons">play_circle_filled</mat-icon>
</button>
CSS
::ng-deep .mat-icon{
height:48px !important;
width:48px !important;
font-size:48px !important;
}
Take a look at the Demo
If you prefer to avoid using `::ng-deep`, you can opt for `ViewEncapsulation.None` (but do so judiciously):
Class:
import {ViewEncapsulation} from '@angular/core';
@Component({
encapsulation: ViewEncapsulation.None
})
This allows you to style directly from the component's stylesheet.
CSS:
.mat-icon{
height:48px !important;
width:48px !important;
font-size:48px !important;
}
See Demo
Another approach is to style it from the main stylesheet, styles.css:
styles.css
.mat-icon{
height:48px !important;
width:48px !important;
font-size:48px !important;
}
See Demo
Lastly, inline styling is also an option for customization:
HTML:
<button mat-button>
<mat-icon style="
height:48px !important;
width:48px !important;
font-size:48px !important;" class="material-icons">play_circle_filled</mat-icon>
</button>
See Demo