2021-11-21 21:08:10 +01:00
# Lucide Static
2025-10-24 05:18:51 -07:00
Static assets and utilities for Lucide icons that work without JavaScript frameworks. This package provides multiple formats including individual SVG files, SVG sprites, icon fonts, and Node.js utilities for server-side rendering and static site generation.
**What you can accomplish:**
- Use individual SVG files as images or CSS background images
- Implement icon fonts for CSS-based icon systems
- Create SVG sprites for efficient icon loading in static sites
- Import SVG strings in Node.js applications and server-side rendering
- Build static websites and applications without JavaScript framework dependencies
2025-06-24 13:18:07 +02:00
This package includes the following implementations of Lucide icons:
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
- Individual SVG files
2023-04-23 10:31:02 +02:00
- SVG sprite
2025-06-24 13:18:07 +02:00
- Icon font files
- A JavaScript library exporting SVG strings
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
## Who is this for?
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
`lucide-static` is suitable for _ very specific use cases _ where you want to use Lucide icons without relying on a JavaScript framework or component system. It's ideal for:
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
- Projects that use icon fonts with plain CSS or utility-first frameworks
- Embedding raw SVG files or sprites directly in HTML
- Using SVGs as CSS background images
- Importing SVG strings into Node.js (CommonJS) environments
::: danger
### Not recommended for production {#production-warning}
SVG sprites and icon fonts include **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:
- [lucide ](lucide )
- [lucide-react ](lucide-react )
- [lucide-vue ](lucide-vue )
- [lucide-vue-next ](lucide-vue-next )
- [lucide-angular ](lucide-angular )
- [lucide-preact ](lucide-preact )
2023-06-12 22:10:15 +02:00
:::
2021-11-21 21:08:10 +01:00
## Installation
2023-06-12 22:10:15 +02:00
::: code-group
```sh [pnpm]
2025-10-26 17:01:12 +01:00
pnpm add lucide-static
2022-10-27 08:19:45 +02:00
```
2021-11-21 21:08:10 +01:00
2023-06-12 22:10:15 +02:00
```sh [yarn]
yarn add lucide-static
```
2021-11-21 21:08:10 +01:00
2023-06-12 22:10:15 +02:00
```sh [npm]
2021-11-21 21:08:10 +01:00
npm install lucide-static
```
2024-11-29 09:11:30 +01:00
```sh [bun]
bun add lucide-static
```
2023-06-12 22:10:15 +02:00
:::
2025-06-24 13:18:07 +02:00
## SVG Files
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
You can use standalone SVG files or SVG sprites in several ways.
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
Check out our [codesandbox example ](https://codesandbox.io/s/using-the-svg-sprite-lz1kk ).
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
### SVG file as image
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
#### In HTML:
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
::: code-group
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
```html [Webpack]
2023-04-23 10:31:02 +02:00
<!-- SVG file for a single icon -->
2024-12-04 09:48:15 +01:00
<img src="~lucide-static/icons/house.svg" />
2021-11-21 21:08:10 +01:00
```
2025-06-24 13:18:07 +02:00
```html [CDN]
<!-- SVG file for a single icon -->
<img src="https://unpkg.com/lucide-static@latest/icons/house .svg" />
```
:::
#### In CSS:
::: code-group
```css [Webpack]
2024-12-04 09:48:15 +01:00
.house-icon {
background-image: url(~lucide-static/icons/house.svg);
2021-11-21 21:08:10 +01:00
}
```
2025-06-24 13:18:07 +02:00
```css [CDN]
.house-icon {
background-image: url(https://unpkg.com/lucide-static@latest/icons/house .svg);
}
```
:::
Make sure you have the correct Webpack loader configured, such as [`url-loader` ](https://v4.webpack.js.org/loaders/url-loader/ ).
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
### SVG file as string
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
To import an SVG as a string (e.g., for templating):
2021-11-21 21:08:10 +01:00
2025-09-11 09:41:17 +02:00
::: code-group
```js [Webpack]
2022-10-27 08:19:45 +02:00
import arrowRightIcon from 'lucide-static/icons/arrow-right';
2021-11-21 21:08:10 +01:00
```
2025-09-11 09:41:17 +02:00
```js [Vite]
import arrowRightIcon from 'lucide-static/icons/arrow-right.svg?raw';
```
:::
2025-06-24 13:18:07 +02:00
You'll need an SVG loader like [`svg-inline-loader` ](https://v4.webpack.js.org/loaders/svg-inline-loader/ ).
2025-09-11 09:41:17 +02:00
2025-06-24 13:18:07 +02:00
### Using the SVG sprite
:::danger
[Not intended for production use. ](#production-warning )
:::
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
You may also need an additional SVG loader to handle this.
#### Basic sprite usage (not production-optimized):
2021-11-21 21:08:10 +01:00
```html
2024-12-04 09:48:15 +01:00
<img src="lucide-static/sprite.svg#house " />
2025-06-24 13:18:07 +02:00
```
#### Inline usage:
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
```html
2021-11-21 21:08:10 +01:00
<svg
width="24"
height="24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<use href="#alert -triangle" />
</svg>
2025-06-24 13:18:07 +02:00
<!-- sprite SVG -->
<svg>...</svg>
2021-11-21 21:08:10 +01:00
```
2025-06-24 13:18:07 +02:00
#### Inline with CSS helper class
If you'd prefer, you can use CSS to hold your base SVG properties:
2021-11-21 21:08:10 +01:00
```css
.lucide-icon {
2022-10-27 08:19:45 +02:00
width: 24px;
height: 24px;
stroke: currentColor;
fill: none;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
2021-11-21 21:08:10 +01:00
}
```
2025-06-24 13:18:07 +02:00
...and update the SVG as follows:
2021-11-21 21:08:10 +01:00
2023-06-04 16:59:38 +02:00
```xml
2021-11-21 21:08:10 +01:00
<svg
xmlns="http://www.w3.org/2000/svg"
class="lucide-icon"
>
2025-06-24 13:18:07 +02:00
<use href="#triangle -alert" />
2021-11-21 21:08:10 +01:00
</svg>
2025-06-24 13:18:07 +02:00
<!-- sprite SVG -->
<svg>...</svg>
2021-11-21 21:08:10 +01:00
```
2025-06-24 13:18:07 +02:00
## Icon font
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
:::danger
[Not intended for production use. ](#production-warning )
:::
Lucide icons are also available as a web font. To use them, you first need to include the corresponding stylesheet:
::: code-group
```css [Vite]
@import 'lucide-static/font/lucide.css';
```
```css [Webpack]
2024-05-03 08:34:04 +02:00
@import ('~lucide-static/font/lucide.css');
2021-11-21 21:08:10 +01:00
```
2025-06-24 13:18:07 +02:00
```html [CDN]
<link rel="stylesheet" href="https://unpkg.com/lucide-static@latest/font/lucide .css" />
```
```html [Static asset]
<link rel="stylesheet" href="/your/path/to/lucide.css" />
```
:::
Once included, use the format `icon-{kebab-case-name}` . You can copy icon names from the [Lucide Icons page ](https://lucide.dev/icons ).
2021-11-21 21:08:10 +01:00
```html
2024-12-04 09:48:15 +01:00
<div class="icon-house"></div>
2021-11-21 21:08:10 +01:00
```
2025-06-24 13:18:07 +02:00
If you're not using a package manager, you can download the font files directly from the [latest release ](https://github.com/lucide-icons/lucide/releases/latest ).
## Node.js
2021-11-21 21:08:10 +01:00
2025-09-11 09:41:17 +02:00
You can also import Lucide icons in Node.js projects:
2021-11-21 21:08:10 +01:00
2025-09-11 09:41:17 +02:00
::: code-group
```js [ESM]
import {MessageSquare} from 'lucide-static';
2021-11-21 21:08:10 +01:00
```
2025-09-11 09:41:17 +02:00
```js [CommonJs]
const {MessageSquare} = require('lucide-static');
```
:::
> Note: Each icon name is in PascalCase.
2021-11-21 21:08:10 +01:00
2025-06-24 13:18:07 +02:00
#### Express app example in Node.js
2021-11-21 21:08:10 +01:00
```js
2025-09-11 09:41:17 +02:00
import express from 'express';
import {MessageSquare} from 'lucide-static';
2022-10-27 08:19:45 +02:00
const app = express();
const port = 3000;
2021-11-21 21:08:10 +01:00
app.get('/', (req, res) => {
res.send(`
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Lucide Icons</h1>
2025-09-11 09:41:17 +02:00
<p>This is a Lucide icon ${MessageSquare}</p>
2021-11-21 21:08:10 +01:00
</body>
</html>
2022-10-27 08:19:45 +02:00
`);
});
2021-11-21 21:08:10 +01:00
app.listen(port, () => {
2022-10-27 08:19:45 +02:00
console.log(`Example app listening at http://localhost:${port}` );
});
2021-11-21 21:08:10 +01:00
```