mat-icon-import
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Import only used material (and custom) icons in Angular

Build Status

Installation

npm i mat-icon-import
#or 
yarn add mat-icon-import

Usage

At first download the icons you need from here in SVG 24px format (default). The icon names are of type baseline-[key]-24px.svg. You will have to use the key when importing this lib.

Import the IconImportModule in your application module and call the forRoot() function with two parameters. At first the array of icon keys, e.g. (account_circle, add or whatever you want). The secont parameter is the path where you store the icons in your assets folder.

import { IconImportModule } from 'mat-icon-import';
 
@NgModule({
  imports: [ IconsModule.forRoot(['account_circle'], './assets/mat-icons') ]
})
export class AppModule {}

Register the icons where you need them. E.g. in the AppComponent to make it available in the complete application.

import { IconImportService } from 'mat-icon-import';
 
@Component({
  ...
})
export class AppComponent {
  constructor (private iconService: IconImportService) {
    this.iconService.register();
  }
}

Use the registered icons with

<mat-icon svgIcon="account_circle"></mat-icon>

Don't forget to include the MatIconModule from @angular/material.

Get in contact

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    113
    • latest

Version History

Package Sidebar

Install

npm i mat-icon-import

Weekly Downloads

120

Version

0.1.1

License

MIT

Unpacked Size

86.8 kB

Total Files

24

Last publish

Collaborators

  • ngfelixl