I'm creating a sample app using material design as per what I've learned so far, but I noticed that the out of the box fonts for the material design are different for different components. For the material title element within a material dialog, the title shows in a nice Roboto font but the material dialog content shows in Roman:
Here's my html component for the dialog:
<h3 mat-dialog-title>{{title}}</h3>
<mat-icon color="primary">error_outline</mat-icon>
<mat-dialog-content>
<ul>
<li *ngFor="let error of errorMessages">
{{error}}
</li>
</ul>
</mat-dialog-content>
I don't want to have to create custom styles but would rather use the default styles associated with the element right out of the box. If I add
body {
font-family: Roboto, Arial, sans-serif;
margin: 0;
}
to my gobal styles.css that fixes the font within the mat-dialog-content but I'd rather not have to do that.
Also, the icon is so tiny as you can clearly see out of the box. Is there a way to choose a larger icon set from the icons library at runtime? Thanks in advance!
Since Angular Material uses ' Material Icons ' Font-Family, the icon size depends on font-size. Therefore, if you want to modify the size of the icon then you change its font-size in your CSS file. In order to properly wrap the font apart from setting the font size you also need to adjust the height and width
In order to use the Angular Material Dialog, we will first need to import MatDialogModule: ... ... ... Notice also CourseDialogComponent, this component will be the body of our custom dialog.
Hence, for various scenarios, you have to use specific icons set, luckily angular material custom-made icons can help you integrate icons using < mat-icon > directive. Let’s check out how to implement vector-based material icons in angular app. The first step is installing the angular app; avoid this step if it is already set up.
Changing Font Awesome Icons color and stroke in Angular. To change the Font Awesome Icons color and stroke we can use style attribute of fa-icon selector as shown below. <fa-icon [icon]=" ['fas', 'film']" [styles]=" {'stroke': 'red', 'color': 'red'}"></fa-icon>. Changing default icon style in Font Awesome Angular.
Looks like the only way I can see from my research is by defining the body element within the global styles.css like so:
body {
font-family: Roboto, Arial, sans-serif;
margin: 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With