Giter VIP home page Giter VIP logo

ng-icons's Introduction

logo
NPM Downloads NPM Version GitHub Sponsors

Ng Icons

The all-in-one icon library for Angular. This allows you to use icons from multiple icon sets with a single icon component. Containing over 38,900 icons for you to use in your projects.

Currently, we support the following libraries:

Got suggestions for additional iconsets? Create an issue and we can consider adding them!

Supporting Ng Icons

Ng Icons is an MIT-licensed open source project with its ongoing development made possible by contributors and sponsors.

Become a Sponsor!.

Supported Versions

Angular Version Ng Icon Version
11.x.x 12.x.x
12.x.x 12.x.x - 13.x.x
13.x.x 13.x.x - 17.x.x
14.x.x 17.x.x - 22.x.x
15.x.x 23.x.x - 24.x.x
16.x.x 25.x.x
17.x.x 26.x.x - 27.x.x

Note: Ng Icons relies on modern browser features and is designed to work on evergreen browsers. We do not support older browsers such as IE11.

Installation

You must install the @ng-icons/core package, however you only need to install the iconset libraries you intend to use.

E.g:

npm i @ng-icons/core @ng-icons/heroicons ...

or

yarn add @ng-icons/core @ng-icons/heroicons ...

Packages

The following packages are available:

Package License
@ng-icons/core MIT
@ng-icons/bootstrap-icons MIT
@ng-icons/heroicons MIT
@ng-icons/ionicons MIT
@ng-icons/material-icons Apache 2.0
@ng-icons/material-file-icons MIT
@ng-icons/css.gg MIT
@ng-icons/feather-icons MIT
@ng-icons/jam-icons MIT
@ng-icons/octicons MIT
@ng-icons/radix-icons MIT
@ng-icons/tabler-icons MIT
@ng-icons/akar-icons MIT
@ng-icons/iconoir MIT
@ng-icons/cryptocurrency-icons CC0-1.0
@ng-icons/simple-icons CC0-1.0
@ng-icons/typicons CC-BY-SA-4.0
@ng-icons/dripicons CC-BY-SA-4.0
@ng-icons/ux-aspects Apache 2.0
@ng-icons/circum-icons MPL-2.0
@ng-icons/remixicon Apache 2.0
@ng-icons/font-awesome CC BY 4.0
@ng-icons/iconsax Custom
@ng-icons/tdesign-icons MIT

Usage

Import the NgIconsModule and register the icons you wish to use:

import { NgIconsModule } from '@ng-icons/core';
import { featherAirplay } from '@ng-icons/feather-icons';
import { heroUsers } from '@ng-icons/heroicons/outline';

@NgModule({
  imports: [BrowserModule, NgIconsModule.withIcons({ featherAirplay, heroUsers })],
})
export class AppModule {}

You can register icons in multiple modules, this allows icons to be lazy loaded in child modules.

You can then use the icon in your templates:

<ng-icon name="featherAirplay"></ng-icon>
Name Type Description
size string Define the size of the icon. This defaults to the current font size.
color string Define the color of the icon. This defaults to the current text color.
strokeWidth string | number Define the stroke-width of the icon. This only works on iconsets that use strokes.

Standalone Components

As of version 18.0.0 Ng Icons nows supports standalone components. You can import icons using the provideIcons function which can be placed anywhere you can register providers. The optimal location would be in the @Component providers array.

You can also import the component directly by importing NgIconComponent or the NG_ICON_DIRECTIVES constant.

import { NgIconComponent, provideIcons } from '@ng-icons/core';
import { featherAirplay } from '@ng-icons/feather-icons';
import { heroUsers } from '@ng-icons/heroicons/outline';

@Component({
  standalone: true,
  imports: [NgIconComponent],
  providers: [provideIcons({ featherAirplay, heroUsers })],
})
export class AppComponent {}

Directly supplying an SVG

Should you need to supply an SVG directly set the svg input to the SVG string. This avoids the need to register the icon. Only icons from NG Icons iconsets will support the color, size and strokeWidth inputs.

import { featherAirplay } from '@ng-icons/feather-icons';

// parent.component.ts
@Component({
  standalone: true,
  template: '<app-child [icon]="icon" />',
})
export class ParentComponent {
  icon = featherAirplay;
}

// child.component.ts
import { NgIconComponent } from '@ng-icons/core';

@Component({
  standalone: true,
  selector: 'app-child',
  imports: [NgIconComponent],
  template: '<ng-icon [svg]="icon" />',
})
export class ChildComponent {
  @Input({ required: true }) icon!;
}

Global Configuration

You can configure the default size of icons by providing a NgIconsConfig object to the provideNgIconsConfig:

NgModule

import { NgIconsModule, provideNgIconsConfig } from '@ng-icons/core';
import { featherAirplay } from '@ng-icons/feather-icons';

@NgModule({
  imports: [BrowserModule, NgIconsModule.withIcons({ featherAirplay, heroUsers })],
  providers: [
    provideNgIconsConfig({
      size: '1.5em',
      color: 'red',
    }),
  ],
})
export class AppModule {}

Standalone

import { NgIconComponent, provideIcons, provideNgIconsConfig } from '@ng-icons/core';

bootstrapApplication(AppComponent, {
  providers: [
    provideNgIconsConfig({
      size: '1.5em',
    }),
  ],
});

Content Security Policy

If your application has a strict Content Security Policy (CSP) you may need to add the following to your global configuration to ensure you do not get any errors.

import { NgIconComponent, provideIcons, provideNgIconsConfig, withContentSecurityPolicy } from '@ng-icons/core';

bootstrapApplication(AppComponent, {
  providers: [provideNgIconsConfig({}, withContentSecurityPolicy())],
});

Logging

By default Ng Icons will log warnings or errors to the console - notably if you try to use an icon that has not been registered. Should you want stricter checks you can enable the ExceptionLogger which will throw an error if you try to use an icon that has not been registered.

You can enable this by providing the withExceptionLogger function to the provideNgIconsConfig function.

import { NgIconComponent, provideIcons, provideNgIconsConfig, withExceptionLogger } from '@ng-icons/core';

bootstrapApplication(AppComponent, {
  providers: [provideNgIconsConfig({}, withExceptionLogger())],
});

Dynamically Loading Icons

The most common way to load icons is simply by registering them individually, however you may want to load icons lazily from a URL, or generate an SVG programatically on the fly. This can be achived using an icon loader. Icon loaders are a function that receives the name of the requested icon, and can return an Observable<string>, Promise<string> or a string containing the SVG to render. Within this function you can do whatever you need to retrieve an icon.

The function is also run within the injection context, this allows you to inject dependencies as you need such as the HttpClient.

bootstrapApplication(AppComponent, {
  providers: [
    provideNgIconLoader(name => {
      const http = inject(HttpClient);
      return http.get(`/assets/icons/${name}.svg`, { responseType: 'text' });
    }),
  ],
});

Additionally add caching to your loader to prevent multiple requests for the same icon.

bootstrapApplication(AppComponent, {
  providers: [
    provideNgIconLoader(name => {...}, withCaching()),
  ],
});

Experimental Features

Variable Icon Fonts

We have added support for variable icon fonts. This is currently only supported by the Material Symbols iconset.

To enable this feature you must install the icon font and load the material-symbols stylesheet. Unlike the static SVG icons, Ng Icons does not bundle the icon font, you must load it yourself.

To use it you must register the variable fonts you want to use. The default iconset will be the first one registered.

import { provideNgGlyphs } from '@ng-icons/core';
import { withMaterialSymbolsOutlined, withMaterialSymbolsRounded } from '@ng-icons/material-symbols';

bootstrapApplication(AppComponent, {
  providers: [provideNgGlyphs(withMaterialSymbolsOutlined(), withMaterialSymbolsRounded())],
});

You can then use the following in your HTML:

<ng-glyph name="settings" />

The following inputs are available on ng-glyph:

Name Type Description
name string Define the name of the icon.
glyphset string Define the glyphset to use. This defaults to the first registered glyphset.
size string | number Define the size of the icon as a pixel value or as a CSS value. This defaults to the current text size.
opticalSize number Define the optical size of the icon in px. This defaults to 20
color string Define the color of the icon. This defaults to the current text color.
weight number Define the weight of the icon. This defaults to 400.
grade number Define the grade of the icon. This defaults to 0.
fill boolean Define if the icon should be filled. This defaults to false.

The default values for size, weight, grade and fill can be configured using the provideNgGlyphsConfig function.

import { provideNgGlyphsConfig } from '@ng-icons/core';

bootstrapApplication(AppComponent, {
  providers: [
    provideNgGlyphsConfig({
      size: 24,
      weight: 400,
      grade: 0,
      fill: false,
    }),
  ],
});

This feature is experimental and does not follow the same versioning as the rest of the library. Breaking changes may be introduced at any time.

We appreciate any feedback you have on this feature.

ng-icons's People

Contributors

ashley-hunter avatar bimendra avatar samuelmaier avatar thesambayo avatar zozzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ng-icons's Issues

Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

I just followed the getting started guide and I get this error while compiling.
Same thing happens for both module based and standalone approach.

Angular version 14.2.12
ng-icons version 23.1.0

The exact error:

node_modules/@ng-icons/core/lib/icon.component.d.ts:20:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.        

20     static ɵcmp: i0.ɵɵComponentDeclaration<NgIconComponent, "ng-icon", never, { "name": "name"; "size": "size"; "strokeWidth": "strokeWidth"; "color": "color"; }, {
}, never, never, true, never>;

@ng-icons/lucide for Angular 16

Describe the bug
I'm using the @ng-icons/lucide icon collection in my Angular 16 project. I assume @ng-icons/lucide has not been updated yet for Angular 16. I am getting an error when running the npm install command.

To Reproduce
Steps to reproduce the behavior:

  1. Create new project with Angular 16
  2. Run npm i @ng-icons/core @ng-icons/lucide
  3. See error

Screenshots
eresolve-report

Packages (please complete the following information):

Add Angular 14 support

✍️ Describe the bug
When trying to install this library in a project with Angular 14 the installation fails.

❌ Error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^14.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@">=12.0.0 <14.0.0" from @ng-icons/[email protected]
npm ERR! node_modules/@ng-icons/core
npm ERR!   @ng-icons/core@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/borja/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/borja/.npm/_logs/2022-06-08T16_13_22_883Z-debug-0.log

✅ Expected behavior
The library must be compatible with Angular 14.

Angular 17 Question/Not Working

I have a question regarding standalone components in Angular 17. Any guidance is highly appreciated, thank you!

Here is what I have tried:

import { NgIconsModule } from '@ng-icons/core';
import { heroUsers } from '@ng-icons/heroicons/outline';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [NgIconsModule.withIcons({ heroUsers })],
  template: `
    <ng-icon name="heroUsers"></ng-icon>
  `,
})

It fails with the error message: Type 'ModuleWithProviders<NgIconsModule>' is not assignable to type 'readonly any[] | Type<any>'.

Here is the stackblitz: https://stackblitz.com/edit/stackblitz-starters-wgxpn9?file=src%2Fmain.ts

I am new to using standalone components, so there might be something off with my understanding with it.

Feature Request: Support throwing error for missing icon

Hi, this is a feature request but a minor one.

We had a bunch of issues in production which were not caught by our tests because we were using ng-icons without adding the icon to provideIcons.

I noticed that there is a warning at:

`No icon named ${name} was found. You may need to import it using the withIcons function.`,

It would be great to see if there is a setting to convert this to an exception that is thrown here or so - so that these can be caught during unit testing

These issues are not caught by the angular language server or tsc currently :(

Browser (please complete the following information):

  • OS: Windows 10 and 11
  • Browser [e.g. chrome, safari]: Chrome Version 122.0.6261.69 (Official Build) (64-bit)

Packages (please complete the following information):

  • @ng-icons/bootstrap-icons
  • Version 26.3.0

How to set size for all icons?

Setting size for each and every icon in a huge project can be cumbersome. How to set a size for all icons in a configuration?

@angular/ssr: NullInjectorError: No provider for InjectionToken Icons Token!

Hi all,
I wanted to use this library on a server-rendered app. But I cannot get it to run or even startup.

Describe the bug
When using this library on Server-Side-Rendering with @angular/ssr, ng-icons causes a NullInjectorError.

To Reproduce
A reproduction is provided via this stackblitz:
https://stackblitz.com/edit/stackblitz-starters-jm48uz?file=src%2Fmain.ts

This app is a simple starter app. What we do is just importing the NgIconsModule in the main component.
Start the app and open the preview. In the browsers console there should be the error.
A screenshot of the error can also be found below.

Expected behavior
The module NgIconsModule can be imported without errors

Screenshots
image

Browser (please complete the following information):

  • OS: Windows 11
  • Browser: Microsoft Edge
  • Version: 122.0.2365.92

Packages (please complete the following information):

  • @ng-icons/core (v27.2.0)
  • @ng-icons/heroicons (v27.2.0)

I hope you can help me find a solution, but for me this looks like a bug that needs to be solved. For any further questions just post an answer here :)

HeroXSolid / HeroXCircleSolid icons not working when using NgIconsModule.withIcons({})

Describe the bug
When using HeroXSolid / HeroXSolidShield icons, they will not show even though they were added to the NgIconsModule.withIcons({<icons>}); function. Any other icon will work without issues, even the outline variant: hero-x / HeroX.

To Reproduce
Steps to reproduce the behavior:

  1. Add an ng-icon using hero-xsolid and/or hero-xsolid-shield to a page
        <ng-icon name="hero-xcircle-solid"></ng-icon>
        <ng-icon name="hero-xsolid"></ng-icon>
  1. Include the icons in the NgIconsModule.withIcons definition:
        NgIconsModule.withIcons({
            HeroXSolid,
            HeroXCircleSolid
        })
  1. Open the browser console and find the issue as provided under the screenshot section.

Any other (solid) icon will work correctly. I haven't found any others that show this issue but I cannot rule them all out as we use a limited set of hero-icons

Expected behavior
The inclusion of the hero-xcircle-solid and hero-xcircle works without issues.

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Browser (please complete the following information):

  • OS: Windows (not OS related)
  • Browser: chrome, edge, firefox] (not browser related)
  • Version: (Chrome) 103.0.5060.66

Packages (please complete the following information):

  • @ng-icons/core v15.1.0
  • @ng-icons/heroicons v15.1.0
  • Version [e.g. 13.0.0]

Additional context
Angular v13.3.8

Problem with inline styling due to not passing the CSP

Describe the bug
Since Angular 16, there is an option to build angular and enable CSP (Content-Security-Policy) header without style-src: unsafe-inline.

However, when I try to add the CSP header and display a ng-icon, I am getting this error in the console:

Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' 'nonce-b1b219ce5ba1b187849df1fb4d143f96'". Either the 'unsafe-inline' keyword, a hash ('sha256-qMdGWD0xk5/9kzCYD1p/dkOpR1wkGW9qb9FIubi/EVE='), or a nonce ('nonce-...') is required to enable inline execution. Note that hashes do not apply to event handlers, style attributes and javascript: navigations unless the 'unsafe-hashes' keyword is present.

I found out it was due to the presence of the style attribute in the <svg> tag.

<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="bi bi-arrow-repeat" viewBox="0 0 16 16" style="width:var(--ng-icon__size, 1em);height:var(--ng-icon__size, 1em)">
...
</svg>

To Reproduce
Steps to reproduce the behavior:

  1. Have Angular 16+ with CSP header enabled but without style-src: unsafe-inline. Example:
Content-Security-Policy: default-src 'self'; style-src 'self' 'nonce-7441868c18e40012f5094f4a1b5a6a02';
  1. Load ng-icons by registering them in AppModule.

Expected behavior
Should have an option to disable the style attribute or replace them by a CSS class in order to satisfy the CSP header.

Browser (please complete the following information):

  • OS: Windows 10
  • Browser chrome
  • Version 121.0.6167.161

Packages (please complete the following information):

  • @ng-icons/bootstrap-icons
  • Version 26.5.0

Terminal Errors after installation

Hey @ashley-hunter,

I appreciate this project you're working on. Recently checked out hero icons and looked for an angular module that would assist me with entering it into my project.

After installation I am getting the following errors in my terminal.

    Error: node_modules/@ng-icons/core/lib/icon.component.d.ts:25:21 - error TS2694: Namespace '"I:/User Profiles/Hamish/Desktop/DiscordRestore/backend/guild-restore-backend/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
    
    25     static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
                           ~~~~~~~~~~~~~~~~~~~~
    node_modules/@ng-icons/core/lib/icon.component.d.ts:26:21 - error TS2694: Namespace '"I:/User Profiles/Hamish/Desktop/DiscordRestore/backend/guild-restore-backend/node_modules/@angular/core/core"' has no exported member 'ɵɵComponentDeclaration'.
    
    26     static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ng-icon", never, { "name": "name"; "size": "size"; }, {}, never, never>;
                           ~~~~~~~~~~~~~~~~~~~~~~
    node_modules/@ng-icons/core/lib/icon.module.d.ts:14:21 - error TS2694: Namespace '"I:/User Profiles/Hamish/Desktop/DiscordRestore/backend/guild-restore-backend/node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.
    
    14     static ɵfac: i0.ɵɵFactoryDeclaration<NgIconsModule, [{ optional: true; }]>;
                           ~~~~~~~~~~~~~~~~~~~~
    node_modules/@ng-icons/core/lib/icon.module.d.ts:15:21 - error TS2694: Namespace '"I:/User Profiles/Hamish/Desktop/DiscordRestore/backend/guild-restore-backend/node_modules/@angular/core/core"' has no exported member 'ɵɵNgModuleDeclaration'.
    
    15     static ɵmod: i0.ɵɵNgModuleDeclaration<NgIconsModule, [typeof i1.IconComponent], never, [typeof i1.IconComponent]>;
                           ~~~~~~~~~~~~~~~~~~~~~
    node_modules/@ng-icons/core/lib/icon.module.d.ts:3m16:21 - error TS2694: Namespace '"I:/User Profiles/Hamish/Desktop/DiscordRestore/backend/guild-restore-backend/node_modules/@angular/core/core"' has no exported member 'ɵɵInjectorDeclaration'.
    
    16     static ɵinj: i0.ɵɵInjectorDeclaration<NgIconsModule>;
                           ~~~~~~~~~~~~~~~~~~~~~
    
✔ Browser application bundle generation complete.

5 unchanged chunks

Build at: 2021-10-12T20:03:25.287Z - Hash: 134ed40a948509e6813c - Time: 1288ms

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 51:206-224
"export 'ɵɵFactoryTarget' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 98:171-189
"export 'ɵɵFactoryTarget' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 53:0-27
"export 'ɵɵngDeclareClassMetadata' (imported as 'i0') was not found in '@angular/core'      

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 101:0-27
"export 'ɵɵngDeclareClassMetadata' (imported as 'i0') was not found in '@angular/core'      

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 52:21-44
"export 'ɵɵngDeclareComponent' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 51:21-42
"export 'ɵɵngDeclareFactory' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 98:21-42
"export 'ɵɵngDeclareFactory' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 100:21-43
"export 'ɵɵngDeclareInjector' (imported as 'i0') was not found in '@angular/core'

Error: ./node_modules/@ng-icons/core/fesm2015/ng-icons-core.js 99:21-43
"export 'ɵɵngDeclareNgModule' (imported as 'i0') was not found in '@angular/core'

If there's any other information I can provide you, let me know. Would be awesome to get this running, and of course I appreciate any help you can offer!

Icon library request: Circum Icons

Hi there,
I'm the maintainer of Circum Icons a library of 285 icons. You can see them at circumicons.com and you can find our repo here. Our icons are available for React, Vue and Svelte. It would be nice to have an alternative for Angular.

Let me know if I can do something.

Thank you!
Circum_Free-1

Wrong Material icon names in version 13.2.0

Describe the bug
The names of all material icons changed the following way:
MatAddCircle -> MatNodeModulesMaterialIconsSvgSvgAddCircle
MatDeleteSweep -> MatNodeModulesMaterialIconsSvgSvgDeleteSweep

To Reproduce
Steps to reproduce the behavior:

  1. Look at this file

Expected behavior
The names stay the way they were defined before. E.g MatAddCircle.

Packages (please complete the following information):

  • @ng-icons/material-icons
  • Version 13.2.0

Icons don't load

Icons are missing on page.

Browser Dev Tools message:
table-sortable.component.html:13 No icon named featherEdit was found. You may need to import it using the withIcons function

The element is present:
<ng-icon _ngcontent-ng-c1038863478="" name="featherEdit" color="red" _nghost-ng-c2936905789="" ng-reflect-name="featherEdit" ng-reflect-color="red" style="--ng-icon__size: 1em; color: red;"></ng-icon>

However I think there is supposed to be some SVG script inside the element? There is none

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent } from './app.component';
import { TableSortableComponent } from './table-sortable/table-sortable.component';
import { NgIconsModule } from '@ng-icons/core';
import { featherAirplay } from '@ng-icons/feather-icons'

@NgModule({
  declarations: [
    AppComponent,
    TableSortableComponent,
  ],
  imports: [
    BrowserModule, HttpClientModule, NgIconsModule.withIcons({ featherAirplay }),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

packages:

{
  "name": "vehicle-app.angular",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --ssl --ssl-cert %APPDATA%\\ASP.NET\\https\\%npm_package_name%.pem --ssl-key %APPDATA%\\ASP.NET\\https\\%npm_package_name%.key --host=127.0.0.1",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "prestart": "node aspnetcore-https"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.2.0",
    "@angular/common": "^16.2.0",
    "@angular/compiler": "^16.2.0",
    "@angular/core": "^16.2.0",
    "@angular/forms": "^16.2.0",
    "@angular/platform-browser": "^16.2.0",
    "@angular/platform-browser-dynamic": "^16.2.0",
    "@angular/router": "^16.2.0",
    "@ng-icons/core": "^25.2.0",
    "@ng-icons/feather-icons": "^25.2.0",
    "jest-editor-support": "*",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.2.1",
    "@angular/cli": "~16.2.1",
    "@angular/compiler-cli": "^16.2.0",
    "@types/jasmine": "~4.3.0",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.1.0",
    "typescript": "~5.1.3"
  }
}

Incorrect angular version in dripicons readme/package.json

Describe the bug
I am unable to use v22.0.0 of the dripicons iconset with angular v14.2.1.

From the readme, it seems v22.0.0 should be compatible with angular v14.2.1; however, the package.json explicitly excludes versions greater than or equal to v14.0.0.

To Reproduce
N/A

Expected behavior
N/A

Screenshots
N/A

Browser
N/A

Packages

  • @ng-icons/core v22.0.0
  • @ng-icons/dripicons v22.0.0
  • @angular/common v14.2.1
  • @angular/core v14.2.1

Additional context
N/A

@ng-icons/circum-icons update for Angular 16

Describe the bug
@ng-icons/circum-icons has not been updated yet for Angular 16. I am getting an error when running the npm install command.

To Reproduce
Steps to reproduce the behavior:

  1. Create new project with Angular 16
  2. Run npm i @ng-icons/core @ng-icons/circum-icons
  3. See error

Screenshots
eresolve-report

Packages (please complete the following information):

Missing Fontawasome Icon Pack

Describe the bug
Actually a question, wondering why fontawesome icon pack is not available, or am I missing something? Thanks

Angular17 Component not rendering

The bug
am using Angular17 and when I add the providers line viewProviders: [provideIcons({ simpleGithub, simpleLinkedin })] the component doesn't render.
my project is a standalone project

Expected behavior
I expect my component to render and to show the icons

import { NgIconComponent, provideIcons } from '@ng-icons/core';
import { simpleGithub, simpleLinkedin } from '@ng-icons/simple-icons';
@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, RouterOutlet, NgIconComponent],
  templateUrl: './app.component.html',
  styleUrl: './app.component.css',
  viewProviders: [provideIcons({  simpleGithub, simpleLinkedin })]

Browser (please complete the following information):

  • OS: Windows
  • Browser: Brave (v1.61.104) & Firefox (v119.0)

Packages
"@ng-icons/core": "^26.3.0",
"@ng-icons/simple-icons": "^26.3.0",

add iconsax

It is a free icon pack that has 6 different variants and over 6,000 icons

tdesign icons non resizable

I appreciate the quick insertion of the Tencent icon pack, but there was a small problem with the inserted icons.

Describe the bug
tdesign icons are being restricted to 24px.

To Reproduce
<ng-icon name="tdesignLightingCircle" size="50px"></ng-icon>
image

Expected behavior
I validated the ng-icons SVG path and the original Tencent repository path. Only the ng-icon one doesn't resize as expected.
image

// ng-icons
<svg
  xmlns="http://www.w3.org/2000/svg"
  fill="none"
  view-box="0 0 24 24"
  class="t-icon t-icon-lighting-circle"
  style="width: 32px; height: 32px"
>
  <path
    fill="currentColor"
    d="M12 21a9 9 0 100-18 9 9 0 000 18zm11-9a11 11 0 11-22 0 11 11 0 0122 0zm-10.92 7.5H10v-5H6.29l5.63-10H14v5h3.71l-5.63 10zM12 15.57l2.29-4.07H12V8.43L9.71 12.5H12v3.07z"
  ></path>
</svg>

// original
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path d="M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C0.999999 5.92487 5.92487 1 12 1C18.0751 0.999999 23 5.92487 23 12ZM12.0848 19.5H10V14.5L6.29015 14.5L11.9152 4.5L14 4.5V9.5L17.7098 9.5L12.0848 19.5ZM12 15.5714L14.2902 11.5H12V8.42862L9.70985 12.5H12L12 15.5714Z" fill="black"/>
  </svg>

Packages:

  • @ng-icons/tdesign-icons
  • Version latest

Not working!!

Icons are not working, the only icon that works is the one in example

When importing Module to standalone: NullInjectorError: No provider for InjectionToken Icons Token!

Good evening,
I get an NullInjectorError: No provider for InjectionToken Icons Token!when I try to use a custom ShellModule that uses NgIconModule. ShellModule is module-based, whereas the consuming AppComponent is standalone. Icons Token is normally provided in NgIconsModule. However, because the consuming component is standalone, it can neither import nor provide NgIconsModule. "Importing just NgIcon" does not help either.

To Reproduce
Steps to reproduce the behavior:

  1. Create a custom Angular 17 library my-ui-lib that uses NgIconsModule and that is module-based
import { NgIconsModule } from '@ng-icons/core';

@NgModule({
    imports: [
        ...
        NgIconsModule,
        ShellComponent
    ],
    exports: [ShellComponent]
})
export class ShellModule {}
  1. create a standalone app with Angular 17 as standalone and import the ShellModule
import { Component, NgModule } from '@angular/core';
import { ShellModule } from '@my-ui-lib/ui-controls';
import { NgIcon, NgIconComponent, NgIconsModule, provideIcons } from '@ng-icons/core';

@Component({
  standalone: true,
  imports: [ButtonModule, ShellModule],
  template: '<my-shell></my-shell>'
})

Expected behavior
Run as is, or at least run without errors after importing NgIconsComponent which is the new standard for ngIcons in standalone components

Browser (please complete the following information):

  • macOS: 13.6.6
  • Chrome: 123.0.6312.107

Packages (please complete the following information):

  • @ng-icons/core: 27.2.0 (also tried v25)
  • @nx/angular: 18.2.2

Workaround (rather unacceptable)

To import the NgIconsModule despite using a standalone parent, one can define an NgModule that imports NgIconsModule and then import it in the standalone parent:

import { Component, NgModule } from '@angular/core';
import { ShellModule } from '@my-ui-lib/ui-controls';
import { NgIcon, NgIconComponent, NgIconsModule, provideIcons } from '@ng-icons/core';


@NgModule({
  imports: [ CommonModule,  NgIconsModule.withIcons({tablerCompass, tablerIndentDecrease, tablerIndentIncrease})],  exports: [NgIconsModule]
})
class UglyWrapperModule{
}

@Component({
  standalone: true,
  imports: [ButtonModule, ShellModule, UglyWrapperModule],
  template: '<my-shell></my-shell>'
})

⚠️ Please don't use this workaround as it goes completely against the standalone concept. However, this example demonstrates that the root cause of the issue is that NgIconsMoudule is incompatible with NgIconsComponent as soon as it is wrapped in an old fashion custom NgModule.

Any help is much appreciated. Let me know if you need more details.

Feature: Support for Materials Symbols

Feature description
A while back, Google published Material Symbols, a better version of material icons giving designers & developers more control over the icons' looks. They are also packaged within a variable font.

Can they be added to ng-icons too?

The list of icons is available here: https://fonts.google.com/icons (some very useful ones like "left panel close" are not in the default material icons font).

error when using ng-icons 22.2.0 with Angular 14.2.1

Describe the bug

When I'm using modularization in angular and I use some icons from ng-icons/heroicons 22.2.0 I get this error
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[InjectionToken Icons Token -> InjectionToken Icons Token -> InjectionToken Icons Token].

I use a shared module, to use components in other modules of the application, in other previous versions this error did not happen to me.

Packages:

  • @ng-icons/core
  • Version [22.2.0]
  • @ng-icons/heroicons
  • Version [22.2.0]

Icon library request: tdesign-icons

Hello, I would like to suggest adding this icon pack. Unfortunately, the official maintainer package does not work as expected in Angular.

In addition to being an MIT licensed pack, it is an icon pack with more than 1200 icons, and can certainly be explored further.

I would really appreciate it if you could do this! :)

https://github.com/Tencent/tdesign-icons

Outdated Octicons

Describe the bug
The npm library for octicons is outdated and has been replaced by a new set under @primer/octicons npm package.

Packages

  • @ng-icons/octicons

Mismatched solid/outlined icons for matForwardToInbox

Describe the bug
When using the matForwardToInbox icon, the outlined version is used instead of the filled variant

To Reproduce
Steps to reproduce the behavior:

  1. Setup an
  2. Add "matForwardToInbox" to app.module.ts
  3. See outlined icon instead of filled icon

Expected behavior
See filled version of matForwardToInbox icon

Screenshots
image

Browser (please complete the following information):

  • OS: macOS
  • Browser Firefox
  • Version 123

Packages (please complete the following information):

  • @ng-icons/core (27.1.0)
  • @ng-icons/material-icons (27.1.0)

Additional context
Other icons all use filled variants, thusly creating a mismatch in the design.

I tried using outgoing mail first but this icon is seemingly not available. Is there a reason for this or should I create a separate issue for missing icons?

size doesnt work in firefox

first of all thanks for this great library! I had a pleasure using it.

Describe the bug
when using firefox and the size attribute the icons are way to big.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/henrysachs/tailwindtuts/tree/9714c3a490af4cf2ad5597ad97cb5e0aa1b77352
  2. run npm install and npm run start
  3. open page with firefox (i used the developer edition) at localhost:4200
  4. See error icons are way to big

Expected behavior
the size that was set for the icons is applied

Screenshots

ng-icons-bug
unknown

Browser (please complete the following information):

  • Windows
  • Firefox in developer or non developer edition see screenshots from 2 systems

Packages (please complete the following information):

  • @ng-icons/hero-icons
  • tailwindcss

Additional context
happy to provide more information if needed
i fixed it by now by setting the text size via css and not via the size property. thats why i linked an explicit commit

Property '"name"' is incompatible with index signature.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Follow the steps on the homepage
import { NgIconsModule } from '@ng-icons/core';
import { heroUsers } from '@ng-icons/heroicons/outline';

@NgModule({
  imports: [
    BrowserModule,
    NgIconsModule.withIcons({ heroUsers }),
  ],
})
export class AppModule {}
<div class="footer-component">
    <div class="socials">
        <ng-icon name="heroUsers"></ng-icon>
    </div>
</div>

Expected behavior
Icon indicated should appear.

Screenshots
I am getting this error instead:

Build at: 2023-09-27T08:14:30.986Z - Hash: 085e7c22caaa5c7c - Time: 626ms

Error: node_modules/@ng-icons/core/lib/icon.component.d.ts:25:70 - error TS2344: Type '{ name: { alias: "name"; required: false; }; size: { alias: "size"; required: false; }; strokeWidth: { alias: "strokeWidth"; required: false; }; color: { alias: "color"; required: false; }; }' does not satisfy the constraint '{ [key: string]: string; }'.
  Property '"name"' is incompatible with index signature.
    Type '{ alias: "name"; required: false; }' is not assignable to type 'string'.

25     static ɵcmp: i0.ɵɵComponentDeclaration<NgIcon, "ng-icon", never, { "name": { "alias": "name"; "required": false; }; "size": { "alias": "size"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; "color": { "alias": "color"; "required": false; }; }, {}, never, never, true, never>;

Browser (please complete the following information):

  • OS: Ubuntu
  • Browser: Google Chrome
  • Version 107.0.5304.110 (Official Build) (64-bit)

Packages (please complete the following information):

"@angular/animations": "^15.2.0",
"@angular/common": "^15.2.0",
"@angular/compiler": "^15.2.0",
"@angular/core": "^15.2.0",
"@angular/forms": "^15.2.0",
"@angular/platform-browser": "^15.2.0",
"@angular/platform-browser-dynamic": "^15.2.0",
"@angular/router": "^15.2.0",
"@ng-icons/bootstrap-icons": "^25.3.1",
"@ng-icons/core": "^25.3.1",
"@ng-icons/heroicons": "^25.3.1",
"bootstrap": "^5.2.3",
"intersection-observer": "^0.12.2",
"ngx-bootstrap": "^10.3.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"

Angular Version

Angular CLI: 15.2.9
Node: 16.16.0
Package Manager: npm 8.11.0
OS: linux x64

Angular: 15.2.9
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.9
@angular-devkit/build-angular   15.2.9
@angular-devkit/core            15.2.9
@angular-devkit/schematics      15.2.9
@schematics/angular             15.2.9
rxjs                            7.8.1
typescript                      4.9.5

Additional context
I've been following the instructions, and I got this error. Not really sure what is wrong.
You can see the error on this branch:
https://gitlab.com/sky-chasers/yamadatarou/-/tree/footer?ref_type=heads

Stroke Width on Solid Hero Icons missing

Describe the bug
The Solid Hero Icon Set is missing the stroke property, and since it is not set to 'currentColor', the strokeWidth does nothing.

To Reproduce
Steps to reproduce the behavior:

  1. Import heroIconXSolid and load it with an ng-icon component in a fresh angular application
  2. change the stroke width
  3. No changes occur in the thickness
  4. Change heroIconXSolid to heroIconX from the outline package
  5. change the stroke width
  6. changes in stroke width are visible

Expected behavior
Stroke width also affects solid hero icons

Packages (please complete the following information):

  • @ng-icons/heroicons
  • Occurs on hero icons 22+, but also applicable to latest version, looking through the source code.

FontAwesome Pack UnAvailable?

Describe the bug
Fontawesome pack missing

To Reproduce
For such a popular font pack as fontawesome, I wonder why it's missing in the library. Or there is something I don't know? Thanks.

Analog Standalone component error

RuntimeError: NG0203: inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with runInInjectionContext. Find more at https://angular.io/errors/NG0203
at injectInjectorOnly (file:///home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:617:15)
at ɵɵinject (file:///home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:628:61)
at inject (file:///home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:711:12)
at new NgIconComponent (file:///home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@ng-icons/core/fesm2022/ng-icons-core.mjs:33:26)
at NodeInjectorFactory.NgIconComponent_Factory [as factory] (ng:///NgIconComponent/ɵfac.js:5:10)
at getNodeInjectable (/@fs/home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:4622:44)
at instantiateAllDirectives (/@fs/home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:11528:27)
at createDirectivesInstances (/@fs/home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:10944:5)
at ɵɵelementStart (/@fs/home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:15207:9)
at Module.ɵɵelement (/@fs/home/sogtheimmortal/Documents/Github/houseofrou/node_modules/@angular/core/fesm2022/core.mjs:15265:5) {
code: -203
}

Node.js v18.15.0

ProvideNgIconLoader doesnt work with ChangeDetection.OnPush

With the following configuration

  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [
    provideNgIconLoader(name => {
      const http = inject(HttpClient);
      return http.get(`/assets/${name}.svg`, { responseType: 'text' });
    })
  ]

The image doesn't get injected into the DOM element, guessing it needs a markForCheck somewhere. Removing the changeDetection (back to default) solves this.

Ng test not working as expected with NgIconsModule

I'm facing test failure while adding NgIconsModule

the test file

import { ComponentFixture, TestBed } from '@angular/core/testing';

import { LoginComponent } from './login.component';

describe('LoginComponent', () => {
  let component: LoginComponent;
  let fixture: ComponentFixture<LoginComponent>;

  beforeEach(async () => {
    await TestBed.configureTestingModule({
      declarations: [LoginComponent]
    })
    .compileComponents();
    
    fixture = TestBed.createComponent(LoginComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});

and the output

Chrome 123.0.0.0 (Windows 10) LoginComponent should create FAILED
        Error: NG0304: 'ng-icon' is not a known element (used in the 'LoginComponent' component template):
        1. If 'ng-icon' is an Angular component, then verify that it is a part of an @NgModule where this component is declared.
        2. If 'ng-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
        error properties: Object({ code: 304 })
            at validateElementIsKnown (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:7240:23)
            at ɵɵelementStart (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:22042:9)
            at ɵɵelement (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:22117:5)
            at templateFn (ng:///LoginComponent.js:63:39)
            at executeTemplate (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:12156:9)            at renderView (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:15289:13)
            at renderComponent (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:15236:5)            at renderChildComponents (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:15334:9)
            at renderView (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:15314:13)
            at ComponentFactory.create (node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@angular/core/fesm2022/core.mjs:15552:13)
Chrome 123.0.0.0 (Windows 10): Executed 10 of 10 (1 FAILED) (0.121 secs / 0.067 secs)

LoginComponent is part of AuthModule and so i register NgIconsModule here

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoginComponent } from './login/login.component';
import { RegisterComponent } from './register/register.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { NgIconsModule } from '@ng-icons/core';
import { ionPerson, ionLockClosed, ionMail, ionEye, ionEyeOff, ionSync, ionRefresh, ionReload } from '@ng-icons/ionicons';
import { AuthRoutingModule } from './auth-routing.module';

@NgModule({
  declarations: [
    LoginComponent,
    RegisterComponent
  ],
  imports: [
    CommonModule,
    FormsModule,
    ReactiveFormsModule,
    NgIconsModule.withIcons({
      ionPerson,
      ionMail,
      ionLockClosed,
      ionEye,
      ionEyeOff,
      ionSync,
      ionReload,
      ionRefresh
    }),
    AuthRoutingModule
  ]
})
export class AuthModule { }

What am i doing wrong here ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.