Integrations
Angular

Angular

The @hugeicons/angular package is freely available on the public npm registry. To use HugeIcons in your Angular project, you'll need to install both the Angular component package and at least one icon package of your choice. This modular approach allows you to keep your bundle size minimal by including only the icons you plan to use.

Installation

  1. Install the Angular component package:
npm install @hugeicons/angular
  1. Install your preferred icon package(s):
npm install @hugeicons-pro/core-{variant}-{style}

Available styles:

HugeIcons Pro offers 36,000+ icons across 9 unique styles:

# Stroke Styles (Line icons with different corner styles)
@hugeicons-pro/core-stroke-rounded
@hugeicons-pro/core-stroke-sharp
@hugeicons-pro/core-stroke-standard
 
# Solid Styles (Filled icons with different corner styles)
@hugeicons-pro/core-solid-rounded
@hugeicons-pro/core-solid-sharp
@hugeicons-pro/core-solid-standard
 
# Special Styles (Unique visual treatments)
@hugeicons-pro/core-bulk-rounded      # Chunky style with depth
@hugeicons-pro/core-duotone-rounded   # Two-color design with primary/secondary emphasis
@hugeicons-pro/core-twotone-rounded   # Alternative two-color treatment

For more detailed information about our core packages and available styles, please visit our Core Packages page.

Module Setup

Import the HugeIcons module in your app.module.ts:

import { NgModule } from '@angular/core';
import { HugeiconsModule } from '@hugeicons/angular';
 
@NgModule({
  imports: [
    HugeiconsModule
  ]
})
export class AppModule { }

Basic Usage

// your.component.ts
import { Component } from '@angular/core';
import { Notification03Icon } from '@hugeicons-pro/core-stroke-rounded';
 
@Component({
  selector: 'app-example',
  template: `
    <hugeicons-icon
      [icon]="notification03Icon"
      [size]="24"
      color="currentColor"
      [strokeWidth]="1.5"
    ></hugeicons-icon>
  `
})
export class ExampleComponent {
  notification03Icon = Notification03Icon;
}

Props

PropTypeDefaultDescription
iconIconSvgObjectRequiredThe main icon component imported from an icon package
altIconIconSvgObject-Alternative icon component from an icon package for states, interactions, or animations
showAltbooleanfalseWhen true, displays the altIcon instead of the main icon
sizenumber24Icon size in pixels
colorstringcurrentColorIcon color (CSS color value)
strokeWidthnumber1.5Width of the icon strokes (works with stroke-style icons)
classstring-Additional CSS classes

Icon Naming

Each icon in our packages can be imported using either its main name or its style-specific alias:

// Both imports refer to the same icon
import { SearchIcon } from '@hugeicons-pro/core-stroke-rounded';
import { SearchStrokeRounded } from '@hugeicons-pro/core-stroke-rounded';

We recommend using the shorter main name (e.g., SearchIcon) for better readability. The style-specific aliases are useful when importing the same icon from different style packages to avoid naming conflicts.

Examples of Dynamic Icon Interactions

Search Bar with Clear Button

A search input that shows a clear button when text is entered:

// search.component.ts
import { Component } from '@angular/core';
import { SearchIcon, CloseCircleIcon } from '@hugeicons-pro/core-stroke-rounded';
 
@Component({
  selector: 'app-search',
  template: `
    <div>
      <input
        [(ngModel)]="searchValue"
        type="text"
        placeholder="Search..."
      />
      <hugeicons-icon
        [icon]="searchIcon"
        [altIcon]="closeIcon"
        [showAlt]="searchValue.length > 0"
        (click)="searchValue.length > 0 ? searchValue = '': null"
      ></hugeicons-icon>
    </div>
  `
})
export class SearchComponent {
  searchIcon = SearchIcon;
  closeIcon = CloseCircleIcon;
  searchValue = '';
}

Theme Toggle with Style Switch

A simple dark mode toggle using different icons:

// theme-toggle.component.ts
import { Component } from '@angular/core';
import { SunIcon, Moon02Icon } from '@hugeicons-pro/core-solid-rounded';
 
@Component({
  selector: 'app-theme-toggle',
  template: `
    <button (click)="isDark = !isDark">
      <hugeicons-icon
        [icon]="sunIcon"
        [altIcon]="moonIcon"
        [showAlt]="isDark"
      ></hugeicons-icon>
    </button>
  `
})
export class ThemeToggleComponent {
  sunIcon = SunIcon;
  moonIcon = Moon02Icon;
  isDark = false;
}

Navigation Bar with Style Switch

A navigation bar that uses different icon styles to indicate the active state:

// nav.component.ts
import { Component } from '@angular/core';
import { 
  HomeIcon,
  SearchIcon,
  Notification03Icon,
  UserIcon 
} from '@hugeicons-pro/core-solid-rounded';
import {
  HomeIcon as HomeDuotone,
  SearchIcon as SearchDuotone,
  Notification03Icon as NotificationDuotone,
  UserIcon as UserDuotone
} from '@hugeicons-pro/core-duotone-rounded';
 
@Component({
  selector: 'app-nav',
  template: `
    <nav>
      <button
        *ngFor="let item of navItems"
        (click)="activeTab = item.id"
        [class.active]="activeTab === item.id"
      >
        <hugeicons-icon
          [icon]="item.solidIcon"
          [altIcon]="item.duotoneIcon"
          [showAlt]="activeTab === item.id"
          [size]="24"
        ></hugeicons-icon>
      </button>
    </nav>
  `
})
export class NavComponent {
  activeTab = 'home';
  
  navItems = [
    { id: 'home', solidIcon: HomeIcon, duotoneIcon: HomeDuotone },
    { id: 'search', solidIcon: SearchIcon, duotoneIcon: SearchDuotone },
    { id: 'notifications', solidIcon: Notification03Icon, duotoneIcon: NotificationDuotone },
    { id: 'profile', solidIcon: UserIcon, duotoneIcon: UserDuotone }
  ];
}