fix(lucide-static): add icon aliases to the SVG sprite (#5200)

* docs(static): remove broken <img> sprite fragment example

Symbols in the sprite only render through <use>, so sprite.svg#name in
an <img> tag shows nothing. Point readers to the per-icon SVG files for
<img> usage instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G9u8FfpNbRB7XQ9kggfSA1

* feat(lucide-static): add icon aliases to the SVG sprite

Aliases were only written as separate SVG files, so `<use href="#home" />`
did not work with the sprite. Each alias is now added as a symbol that
references the original icon's symbol with a nested `<use>`, instead of
duplicating its elements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G9u8FgapYRzb6uRJnZpW7N

* Adjusted documentation

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Eric Fennis
2026-11-16 10:25:14 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent f6571da835
commit 5fc65e1f1d
3 changed files with 34 additions and 15 deletions
+3 -13
View File
@@ -8,20 +8,10 @@ import Sandpack from '~/.vitepress/theme/components/editors/Sandpack.vue'
Learn how to use SVG sprites with Lucide icons in your project, including basic usage and inline options.
:::warning Not recommended for high traffic production use
The SVG sprite includes all icons, which can significantly increase your app's bundle size and load time. For production environments, we recommend using a bundler with tree-shaking support to include only the icons you actually use. Consider using one of the framework-specific [packages](../../packages.md).
:::
SVG sprites can be loaded as individual image, or used inline with the `<use>` element.
The sprite is used inline: you put it in your page and reference icons with the `<use>` element.
You may also need an additional SVG loader to handle node_modules imports in your project. Check out our [codesandbox example](https://codesandbox.io/s/using-the-svg-sprite-lz1kk) for a working example.
## Basic sprite usage
SVG sprites can be imported directory in img tags, and select the icon with <br>the `#{icon-name}` syntax:
```html
<img src="lucide-static/sprite.svg#house" />
```
To use the sprite, add it inline and reference icons with `<use>`, as shown below.
## Inline usage
@@ -104,5 +94,5 @@ import sprite from "lucide-static/sprite.svg";
document.getElementById('sprite').innerHTML = sprite;
```
:::