docs/guide/angular/migration.md
lucide-angular ⇒ @lucide/angular@lucide/angular moves from a module + single component based API to a more modern Angular approach:
provideLucideIcons(), not using NgModule.svg[lucideIcon]).provideLucideConfig().Remove lucide-angular, and add @lucide/angular, see:
Getting Started # Installation
LucideAngularModule.pick(...) with provideLucideIcons(...)Notes:
- Old imports like
AirVentIcon/AlarmClockfromlucide-angularshould be replaced with the new per-icon exportsLucideAirVentandLucideAlarmClock.- If you mostly used static icons, you may not need to provide them at all, please refer to Step 3.
import { BrowserModule, NgModule } from '@angular/core';
import { LucideAngularModule, AirVent, AlarmClock } from 'lucide-angular';
@NgModule({
imports: [
BrowserModule,
LucideAngularModule.pick({ AirVent, AlarmClock }),
],
})
export class AppModule {}
import { ApplicationConfig } from '@angular/core';
import { LucideAngularModule, AirVent, AlarmClock } from 'lucide-angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
importProvidersFrom(LucideAngularModule.pick({ AirVent, AlarmClock })),
]
};
import { ApplicationConfig } from '@angular/core';
import { provideLucideIcons, LucideAirVent, LucideAlarmClock } from '@lucide/angular';
export const appConfig: ApplicationConfig = {
providers: [
// ...
provideLucideIcons(
LucideAirVent,
LucideAlarmClock,
),
]
};
<lucide-angular> / <lucide-icon> / <i-lucide> / <span-lucide>The legacy package rendered everything through a single component. All of these selectors must be migrated to <svg> usage.
If the icon is known at build time, just use a static import:
<lucide-angular name="circle-check"></lucide-angular>
<svg lucideCircleCheck></svg>
import { CircleCheck } from 'lucide-angular';
<lucide-icon [img]="CircleCheck"></lucide-icon>
import { LucideCircleCheck } from '@lucide/angular';
<svg lucideCircleCheck></svg>
...and import LucideCircleCheck from @lucide/angular.
If the icon varies at runtime, use the dynamic component:
<lucide-icon [name]="item.icon"></lucide-icon>
<svg [lucideIcon]="item.icon"></svg>
LucideIconConfig with provideLucideConfig()import { inject } from '@angular/core';
import { LucideIconConfig } from 'lucide-angular';
inject(LucideIconConfig).size = 12;
import { provideLucideConfig } from '@lucide/angular';
providers: [
provideLucideConfig({ size: 12 }),
]
AppModule.providers or bootstrapApplication(...providers)providersIf using per-icon-components:
If using the dynamic component:
provideLucideIcons() if using string names@lucide/angular and not the legacy packageMake sure you're importing from @lucide/angular and not lucide-angular.
provideLucideConfig() is used at the right level.Brand icons are removed in v1. If you are using any of the following icons, you will need to replace them with a custom SVG or an alternative icon:
We recommend to use the official SVG icons provided by the respective brands, most of them can be found on their websites or in their brand guidelines. Alternatively, you can use the icons from Simple Icons, which provides a large collection of brand icons. Also with links to the official Brand Guidelines and SVG icons.
An Angular package for Simple Icons with standalone component support is also available.
LucideAngularModule ⇒ static: removed; dynamic: LucideIconLucideAngularModule.pick(...) ⇒ provideLucideIcons(...)<lucide-angular name="foo-bar"> ⇒ <svg lucideFooBar><lucide-icon [name]="expr"> ⇒ <svg [lucideIcon]="expr"><lucide-icon [img]="expr"> ⇒ <svg [lucideIcon]="expr">LucideIconConfig ⇒ provideLucideConfig(...)simple-icons.