Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 6 Material Dialog Font Discrepancies and Material Icon Size Modification

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: enter image description here

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!

like image 564
ustad Avatar asked Oct 19 '18 17:10

ustad


People also ask

How to change the size of the icon in Angular Material?

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

How to use the angular material dialog?

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.

How to implement vector-based material icons in angular app?

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.

How to change Font Awesome icons color and stroke in angular?

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.


1 Answers

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;
}
like image 132
ustad Avatar answered Oct 02 '22 15:10

ustad