1.0.0-alpha.3 • Published 7 years ago

@ngx-kit/icons v1.0.0-alpha.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

@ngx-kit/icon

Installation

npm install @ngx-kit/icons --save

Usage

Import module

import { KitIconsModule } from '@ngx-kit/icons';
..
@NgModule({
  imports: [
    KitIconsModule.forRoot(),
...

Use import with .forRoot() only once on the top level. In other modules just import KitIconsModule.

Register icons

import { KitIconsRegistryService } from '@ngx-kit/icons';
...
constructor(private iconsRegistry: KitIconsRegistryService) {
  this.iconsRegistry.register('star', '/assets/icons/star.svg');
  // or
  this.iconsRegistry.registerSet([
      {name: 'star', url: '/assets/icons/star.svg'},
      {name: 'cloud', url: '/assets/icons/cloud.svg'},
  ]);
}

Use in a template

<kit-icon [name]="'star'"></kit-icon>

API

PropertyTypeDefaultDescription
name (required)stringnullName in the registry
colorstring (any css color)nullSvg fill color
sizenumber24Size in pixels