Files
lucide/docs/guide/angular/advanced/with-lucide-lab.md
713b1fcd25 feat(docs): added better contribution guide (#4746)
* Add metadata information

* improve contribution

* feat(docs): added new contribution guide

* feat(docs): minor linting fix

* feat(docs): update dead link

* feat(docs): change layout, some stylistic change, et cetera

* feat(docs): alter metadata example layout

* feat(docs): update titles, split use case & tag guide

* feat(docs): finetune some design guide images & make

* feat(docs): finetune some design guide images & add icons to use case guide

* feat(docs): added ux writing instructions & proofread markdowns to match these guidelines

* feat(docs): updated design language / specification descriptions to better distinguish what is what

* feat(docs): updated design language / specification descriptions to better distinguish what is what

* feat(docs): changed some languages again

* fix(icons): add design principle do/dont about diagonal lines

* fix(icons): decrease blurriness of ideal pixel perfection pixel preview

* fix(icons): remove color from pixel perfection previews

* fix(icons): remove color from pixel perfection previews

* fix(icons): reword symmerical icon rule

* fix(icons): fix calendar design in density rule image

* fix(icons): slightly adjust centered stroke rule text

* Rename 'useCases' property to 'use-cases'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Update allowed SVG elements in code conventions

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-09-04 12:24:52 +02:00

127 lines
3.5 KiB
Markdown

---
title: Lucide Lab - Angular
description: Learn how to use icons from Lucide Lab in your Angular application.
---
<script setup>
import Sandpack from '~/.vitepress/theme/components/editors/SandpackAngular.vue'
</script>
# With Lucide Lab or custom icons
[Lucide Lab](https://github.com/lucide-icons/lucide-lab) is a collection of icons that are not part of the Lucide main library.
While they aren't provided as standalone components, they can be still be passed to the `LucideIcon` component the same way as official icons:
::: info Limitation
Only custom icons that follow Lucide's [code conventions](../../../contribute/icons/code-conventions.md#code-conventions) are supported.
:::
### Directly as LucideIconData
::: sandpack {template=angular showTabs=false editorHeight=400 editorWidthPercentage=60 dependencies="@lucide/angular,@lucide/lab"}
```ts /src/app/app.component.ts [active]
import { Component, ViewEncapsulation, signal } from "@angular/core";
import { LucideDynamicIcon, lucideLegacyIcon } from '@lucide/angular';
import { coconut } from '@lucide/lab';
@Component({
selector: 'app',
template: `
<svg [lucideIcon]="icon()"></svg>
`,
imports: [LucideDynamicIcon],
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class App {
readonly icon = signal(lucideLegacyIcon('coconut', coconut));
}
```
:::
### As a provided icon by name
::: sandpack {template=angular editorHeight=400 editorWidthPercentage=60 dependencies="@lucide/angular,@lucide/lab"}
```ts /src/app/app.component.ts [active]
import { Component, ViewEncapsulation } from "@angular/core";
import { LucideDynamicIcon } from '@lucide/angular';
@Component({
selector: 'app',
template: `
<svg lucideIcon="bat-ball"></svg>
`,
imports: [LucideDynamicIcon],
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class App {
}
```
```ts /src/app/app.config.ts
import { ApplicationConfig } from '@angular/core';
import { lucideLegacyIcon, provideLucideIcons } from '@lucide/angular';
import { batBall } from '@lucide/lab';
export const appConfig: ApplicationConfig = {
providers: [
provideLucideIcons(
lucideLegacyIcon('bat-ball', batBall)
)
]
};
```
:::
### Creating custom icon components
You can also create your own standalone icon components using `LucideIconBase`.
Be sure to use an SVG element selector, e.g. `svg[lucide{IconName}]`
::: sandpack {template=angular editorHeight=400 editorWidthPercentage=60 dependencies="@lucide/angular,@lucide/lab"}
```ts /src/icons/bottle-champagne.ts
import {
LucideIconBase,
lucideIconTemplate,
lucideLegacyIcon
} from '@lucide/angular';
import { Component, signal } from '@angular/core';
import { bottleChampagne } from '@lucide/lab';
@Component({
selector: 'svg[lucideBottleChampagne]',
template: lucideIconTemplate,
standalone: true,
})
export class LucideBottleChampagne extends LucideIconBase {
static readonly icon = lucideLegacyIcon('bottle-champagne', bottleChampagne);
protected override readonly icon = signal(LucideBottleChampagne.icon);
}
```
```ts /src/app/app.component.ts
import { Component, ViewEncapsulation, signal } from "@angular/core";
import { LucideDynamicIcon, lucideLegacyIcon } from '@lucide/angular';
import { LucideBottleChampagne } from "../icons/bottle-champagne";
@Component({
selector: 'app',
template: `<svg lucideBottleChampagne></svg>`,
imports: [LucideBottleChampagne],
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None,
})
export class App {
}
```
:::