packages/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, add @lucide/angular, see http://lucide.dev/guide/packages/angular#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.
Ensure provideLucideConfig() is used at the right level.
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(...)