Skip to content

Commit 7091e5c

Browse files
committed
feat(material/icon): Change icon font default to Material symbols from Material icons
1 parent 9939029 commit 7091e5c

File tree

11 files changed

+29
-27
lines changed

11 files changed

+29
-27
lines changed

guides/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The `ng add` command will additionally perform the following actions:
3535

3636
* Add project dependencies to `package.json`
3737
* Add the Roboto font to your `index.html`
38-
* Add the Material Design icon font to your `index.html`
38+
* Add the Material Symbols icon font to your `index.html`
3939
* Add a few global CSS styles to:
4040
* Remove margins from `body`
4141
* Set `height: 100%` on `html` and `body`
@@ -48,7 +48,7 @@ You're done! Angular Material is now configured to be used in your application.
4848
Let's display a slide toggle component in your app and verify that everything works.
4949

5050
You need to import the `MatSlideToggleModule` that you want to display by adding the following lines to
51-
your standalone component's imports, or otherwise your component's `NgModule`.
51+
your standalone component's imports, or otherwise your component's `NgModule`.
5252

5353
```ts
5454
import { MatSlideToggleModule } from '@angular/material/slide-toggle';

guides/schematics.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@ In case you just want to install the `@angular/cdk`, there are also schematics f
2222
ng add @angular/cdk
2323
```
2424

25-
The Angular Material `ng add` schematic helps you set up an Angular CLI project that uses Material. Running `ng add` will:
25+
The Angular Material `ng add` schematic helps you set up an Angular CLI project that uses Material.
26+
See the [`getting started guide](./getting-started#install-angular-material) for more information.
2627

27-
- Ensure [project dependencies](./getting-started#step-1-install-angular-material-angular-cdk-and-angular-animations) are placed in `package.json`
28-
- Enable the [BrowserAnimationsModule](./getting-started#step-2-configure-animations) in your app module
28+
Running `ng add` will:
29+
30+
- Ensure project dependencies are placed in `package.json`
31+
- Enable the BrowserAnimationsModule in your app module
2932
- Add either a prebuilt theme or a custom theme
3033
- Add Roboto fonts to your `index.html`
31-
- Add the [Material Icon font](./getting-started#step-6-optional-add-material-icons) to your `index.html`
34+
- Add the Material Symbols font to your `index.html`
3235
- Add global styles to
3336
- Remove margins from `body`
3437
- Set `height: 100%` on `html` and `body`

integration/yarn-pnp-compat/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<link rel="icon" type="image/x-icon" href="favicon.ico">
99
<link rel="preconnect" href="https://fonts.gstatic.com">
1010
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
11-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
11+
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
1212
</head>
1313
<body class="mat-typography">
1414
<app-root></app-root>

src/e2e-app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<base href="/">
88

99
<link rel="preconnect" href="https://fonts.gstatic.com">
10-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
10+
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
1111
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
1212
<link href="theme.css" rel="stylesheet">
1313
</head>

src/material/icon/icon-registry.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ export class MatIconRegistry implements OnDestroy {
145145

146146
/**
147147
* The CSS classes to apply when an `<mat-icon>` component has no icon name, url, or font
148-
* specified. The default 'material-icons' value assumes that the material icon font has been
149-
* loaded as described at https://google.github.io/material-design-icons/#icon-font-for-the-web
148+
* specified. The default 'material-symbols-outlined' value assumes that the material icon font
149+
* has been loaded as described at https://google.github.io/material-design-icons/#icon-font-for-the-web
150150
*/
151-
private _defaultFontSetClass = ['material-icons', 'mat-ligature-font'];
151+
private _defaultFontSetClass = ['material-symbols-outlined', 'mat-ligature-font'];
152152

153153
constructor(
154154
@Optional() private _httpClient: HttpClient,

src/material/icon/icon.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ Some fonts are designed to show icons by using
1717
component.
1818

1919
By default, `<mat-icon>` expects the
20-
[Material icons font](https://google.github.io/material-design-icons/#icon-font-for-the-web).
20+
[Material Symbols](https://developers.google.com/fonts/docs/material_symbols#use_in_web).
2121
(You will still need to include the HTML to load the font and its CSS, as described in the link).
2222

23-
You can specify a different font, such as Material's latest icons,
24-
[Material Symbols](https://fonts.google.com/icons), by setting the `fontSet` input to either the
25-
CSS class to apply to use the desired font, or to an alias previously registered with
26-
`MatIconRegistry.registerFontClassAlias`. Alternatively you can set the default for all
27-
your application's icons using `MatIconRegistry.setDefaultFontSetClass`.
23+
You can specify a different font, set the `fontSet` input to either the CSS class to apply to the
24+
desired font, or to an alias previously registered with `MatIconRegistry.registerFontClassAlias`.
25+
Alternatively you can set the default for all your application's icons using
26+
`MatIconRegistry.setDefaultFontSetClass`.
2827

2928
### Font icons with CSS
3029

src/material/icon/icon.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('MatIcon', () => {
122122
'mat-icon',
123123
'mat-ligature-font',
124124
'mat-primary',
125-
'material-icons',
125+
'material-symbols-outlined',
126126
'notranslate',
127127
]);
128128
});
@@ -141,7 +141,7 @@ describe('MatIcon', () => {
141141
'mat-icon',
142142
'mat-icon-no-color',
143143
'mat-ligature-font',
144-
'material-icons',
144+
'material-symbols-outlined',
145145
'notranslate',
146146
]);
147147
});
@@ -178,7 +178,7 @@ describe('MatIcon', () => {
178178
});
179179

180180
describe('Ligature icons', () => {
181-
it('should add material-icons and mat-ligature-font class by default', () => {
181+
it('should add material-symbols-outlined and mat-ligature-font class by default', () => {
182182
const fixture = TestBed.createComponent(IconWithLigature);
183183

184184
const testComponent = fixture.componentInstance;
@@ -190,7 +190,7 @@ describe('MatIcon', () => {
190190
'mat-icon',
191191
'mat-icon-no-color',
192192
'mat-ligature-font',
193-
'material-icons',
193+
'material-symbols-outlined',
194194
'notranslate',
195195
]);
196196
});
@@ -265,7 +265,7 @@ describe('MatIcon', () => {
265265
expect(icon.getAttribute('fontIcon')).toBe('house');
266266
});
267267

268-
it('should add material-icons and mat-ligature-font class by default', () => {
268+
it('should add material-symbols-outlined and mat-ligature-font class by default', () => {
269269
const fixture = TestBed.createComponent(IconWithLigatureByAttribute);
270270

271271
const testComponent = fixture.componentInstance;
@@ -277,7 +277,7 @@ describe('MatIcon', () => {
277277
'mat-icon',
278278
'mat-icon-no-color',
279279
'mat-ligature-font',
280-
'material-icons',
280+
'material-symbols-outlined',
281281
'notranslate',
282282
]);
283283
});

src/material/icon/testing/fake-icon-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class FakeMatIconRegistry implements PublicApi<MatIconRegistry>, OnDestro
6161
}
6262

6363
getDefaultFontSetClass() {
64-
return ['material-icons'];
64+
return ['material-symbols-outlined'];
6565
}
6666

6767
getSvgIconFromUrl(): Observable<SVGElement> {

src/material/schematics/ng-add/fonts/material-fonts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function addFontsToIndex(options: Schema): Rule {
2828

2929
const fonts = [
3030
'https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap',
31-
'https://fonts.googleapis.com/icon?family=Material+Icons',
31+
'https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined',
3232
];
3333

3434
projectIndexFiles.forEach(indexFilePath => {

src/material/schematics/ng-add/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ describe('ng-add schematic', () => {
162162
// the created links properly align with the existing HTML. Default CLI projects use an
163163
// indentation of two columns.
164164
expect(htmlContent).toContain(
165-
' <link href="https://fonts.googleapis.com/icon?family=Material+Icons"',
165+
' <link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined"',
166166
);
167167
expect(htmlContent).toContain(
168168
' <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@' +

src/universal-app/index-source.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>Angular Material Universal Kitchen Sink Test</title>
77
<link href="styles.css" rel="stylesheet">
88
<link rel="preconnect" href="https://fonts.gstatic.com">
9-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
9+
<link href="https://fonts.googleapis.com/icon?family=Material+Symbols+Outlined" rel="stylesheet">
1010
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
1111
<base href="/">
1212
</head>

0 commit comments

Comments
 (0)