|
| 1 | +# Material Icons and Symbols Usage Guide |
| 2 | + |
| 3 | +This application now supports both **Material Design Icons** and **Material Design Symbols**. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +- **Material Icons**: The original icon font from Google (ligature-based) |
| 8 | +- **Material Symbols**: The newer variable font system with customizable styles |
| 9 | + |
| 10 | +## Using Material Icons (Default) |
| 11 | + |
| 12 | +Material Icons is the default font set. Simply use `<mat-icon>` without any special attributes: |
| 13 | + |
| 14 | +```html |
| 15 | +<!-- Default Material Icons --> |
| 16 | +<mat-icon>home</mat-icon> |
| 17 | +<mat-icon>settings</mat-icon> |
| 18 | +<mat-icon>menu</mat-icon> |
| 19 | +``` |
| 20 | + |
| 21 | +## Using Material Symbols |
| 22 | + |
| 23 | +To use Material Symbols, specify the `fontSet` attribute: |
| 24 | + |
| 25 | +### Outlined Style (Default for Symbols) |
| 26 | +```html |
| 27 | +<mat-icon fontSet="material-symbols-outlined">home</mat-icon> |
| 28 | +<mat-icon fontSet="material-symbols-outlined">settings</mat-icon> |
| 29 | +``` |
| 30 | + |
| 31 | +### Rounded Style |
| 32 | +```html |
| 33 | +<mat-icon fontSet="material-symbols-rounded">home</mat-icon> |
| 34 | +<mat-icon fontSet="material-symbols-rounded">favorite</mat-icon> |
| 35 | +``` |
| 36 | + |
| 37 | +### Sharp Style |
| 38 | +```html |
| 39 | +<mat-icon fontSet="material-symbols-sharp">home</mat-icon> |
| 40 | +<mat-icon fontSet="material-symbols-sharp">star</mat-icon> |
| 41 | +``` |
| 42 | + |
| 43 | +## Additional Styling Options |
| 44 | + |
| 45 | +### Material Symbols with Custom Variations |
| 46 | + |
| 47 | +Material Symbols support variable font features: |
| 48 | + |
| 49 | +```html |
| 50 | +<!-- Filled icon --> |
| 51 | +<mat-icon fontSet="material-symbols-outlined" class="filled">favorite</mat-icon> |
| 52 | + |
| 53 | +<!-- Light weight --> |
| 54 | +<mat-icon fontSet="material-symbols-outlined" class="light">home</mat-icon> |
| 55 | + |
| 56 | +<!-- Bold weight --> |
| 57 | +<mat-icon fontSet="material-symbols-outlined" class="bold">settings</mat-icon> |
| 58 | +``` |
| 59 | + |
| 60 | +### Size Classes (Works for both Icons and Symbols) |
| 61 | + |
| 62 | +```html |
| 63 | +<!-- 18px --> |
| 64 | +<mat-icon class="md-18">home</mat-icon> |
| 65 | + |
| 66 | +<!-- 24px (default) --> |
| 67 | +<mat-icon class="md-24">home</mat-icon> |
| 68 | + |
| 69 | +<!-- 36px --> |
| 70 | +<mat-icon class="md-36">home</mat-icon> |
| 71 | + |
| 72 | +<!-- 48px --> |
| 73 | +<mat-icon class="md-48">home</mat-icon> |
| 74 | +``` |
| 75 | + |
| 76 | +### Color Classes |
| 77 | + |
| 78 | +```html |
| 79 | +<!-- Danger/Error color --> |
| 80 | +<mat-icon class="material-icon-danger">error</mat-icon> |
| 81 | + |
| 82 | +<!-- Success color --> |
| 83 | +<mat-icon class="material-icon-success">check_circle</mat-icon> |
| 84 | +``` |
| 85 | + |
| 86 | +### Pointer Cursor |
| 87 | + |
| 88 | +```html |
| 89 | +<!-- Add pointer cursor for clickable icons --> |
| 90 | +<mat-icon class="material-icon-pointer" (click)="handleClick()">info</mat-icon> |
| 91 | +``` |
| 92 | + |
| 93 | +## Examples |
| 94 | + |
| 95 | +### Combining Multiple Classes |
| 96 | + |
| 97 | +```html |
| 98 | +<!-- Large, filled symbol with pointer cursor --> |
| 99 | +<mat-icon fontSet="material-symbols-rounded" |
| 100 | + class="md-48 filled material-icon-pointer" |
| 101 | + (click)="toggleFavorite()"> |
| 102 | + favorite |
| 103 | +</mat-icon> |
| 104 | + |
| 105 | +<!-- Small danger icon --> |
| 106 | +<mat-icon class="md-18 material-icon-danger">warning</mat-icon> |
| 107 | +``` |
| 108 | + |
| 109 | +### Using with Buttons |
| 110 | + |
| 111 | +```html |
| 112 | +<!-- Material Icons (default) --> |
| 113 | +<button mat-icon-button> |
| 114 | + <mat-icon>more_vert</mat-icon> |
| 115 | +</button> |
| 116 | + |
| 117 | +<!-- Material Symbols --> |
| 118 | +<button mat-icon-button> |
| 119 | + <mat-icon fontSet="material-symbols-rounded">more_vert</mat-icon> |
| 120 | +</button> |
| 121 | +``` |
| 122 | + |
| 123 | +## Icon Availability |
| 124 | + |
| 125 | +- Material Icons: https://fonts.google.com/icons?icon.set=Material+Icons |
| 126 | +- Material Symbols: https://fonts.google.com/icons?icon.set=Material+Symbols |
| 127 | + |
| 128 | +Note: Most icon names are the same between both sets, but always verify on the Google Fonts website. |
| 129 | + |
| 130 | +## Technical Details |
| 131 | + |
| 132 | +### Loaded Font Families |
| 133 | +- `Material Icons` (default) |
| 134 | +- `Material Symbols Outlined` |
| 135 | +- `Material Symbols Rounded` |
| 136 | +- `Material Symbols Sharp` |
| 137 | + |
| 138 | +### Font Variation Settings for Symbols |
| 139 | + |
| 140 | +Material Symbols use OpenType variable font features: |
| 141 | +- `FILL`: 0 (outlined) to 1 (filled) |
| 142 | +- `wght`: 100 to 700 (weight) |
| 143 | +- `GRAD`: -50 to 200 (grade) |
| 144 | +- `opsz`: 20 to 48 (optical size) |
| 145 | + |
| 146 | +These are automatically set based on size and style classes in `_icon.scss`. |
0 commit comments