Compare commits

...

11 Commits

Author SHA1 Message Date
Jonas Höbenreich
7ed206af4a Add alternative arrow icons (#1227)
* add move-left icon

* add move-right icon

* add move-down-left icon

* add move-down-right icon

* add move-down icon

* add move-up-right icon

* add move-up-left icon

* add move-up icon

* fix formatting
2023-05-30 21:47:04 +02:00
Daniel Bayley
95daa7c313 Add pilcrow-square icon (#1311)
* Add `pilcrow-square` icon

* Improve `pilcrow` metadata
2023-05-30 21:00:15 +02:00
Karsa
17ecb92946 [Packages][Lucide] Switch to data-lucide (#1169)
* [packages][lucide] Switch to the HTML attribute data-lucide instead of icon-name

* fix tests

* Update lucide.ts

Add BC for `icon-name`.

* Update packages/lucide/src/lucide.ts

Co-authored-by: Karsa <contact@karsa.org>

---------

Co-authored-by: Karsa <karsa@karsa.org>
Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2023-05-30 20:42:41 +02:00
Daniel Bayley
9ef9921f04 Add scatter-chart icon (#1165)
* Add `scatter-chart` icon

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
2023-05-29 13:24:42 +02:00
Jesús Ferretti
ac08bb92c1 fix(docs): fix typos and improve docs in Comparison (#1309)
* fix(docs): fix typos and improve docs in Comparison

* Update docs/comparison.md
2023-05-28 19:38:01 +02:00
Karsa
53109037ec Increases ticket in size as per #1192 (#1292) 2023-05-28 12:17:43 +02:00
Daniel Bayley
66de90d63e Optimise monitor icons/add [monitor-]play/dot/check icons (#1282)
* Optimise `monitor` icons

* Add `monitor-play` icon

* Add `monitor-check` icon

* Add `monitor-dot` icon

* Added monitor-x, monitor-stop & monitor-pause

* Update monitor-pause.json

* Update icons/monitor-play.svg

Co-authored-by: Jakob Guddas <github@jguddas.de>

* Decrease monitor-x x size.

---------

Co-authored-by: Karsa <contact@karsa.org>
Co-authored-by: Jakob Guddas <github@jguddas.de>
2023-05-28 12:12:43 +02:00
Daniel Bayley
f3c7e44a3d Add [square-]pi/sigma icons (#1278)
* Add `pi-square` icon

* Add `sigma-square` icon
2023-05-28 11:57:00 +02:00
Jakob Guddas
3823993c39 Optimized umbrella (#1295) 2023-05-28 11:49:28 +02:00
Daniel Bayley
36c53f956a Add play-square icon (#1283)
* Improve `play` icon metadata

* Add `play-square` icon

* Update play-square.svg

---------

Co-authored-by: Karsa <contact@karsa.org>
2023-05-28 11:48:32 +02:00
Eric Fennis
58c652908a Add strokeWidth type for lucide-vue-next (#1246) 2023-05-28 11:46:23 +02:00
54 changed files with 635 additions and 40 deletions

View File

@@ -6,20 +6,20 @@ title: Comparison
## Lucide vs Feather Icons
Lucide is a community-run fork of [Feather Icons](https://github.com/feathericons/feather).
Lucide is a community-driven fork of [Feather Icons](https://github.com/feathericons/feather).
It began after growing disaffection of the [Feather Icons](https://github.com/feathericons/feather) project moderation. With over 300+ open issues and over 100+ open PRs, the Feather Icons project has been abandoned and not maintained actively. This unfortunately means that hundreds of developers and designers wasted their time contributing to Feather Icons with no chance of PRs being accepted.
The decision to create Lucide arose from growing dissatisfaction with the moderation of the Feather Icons project. With more than 300 open issues and over 100 open PRs, the Feather Icons project has been abandoned and is no longer actively maintained. Unfortunately, this means that numerous developers and designers have invested their time in contributing to Feather Icons without the possibility of their PRs being accepted.
Lucide is trying to expand the icon set as much as possible while staying faithful to the original simplistic design language. We do this as a community of devs and designers.
In an effort to expand the icon set while remaining true to the original minimalist design language, Lucide is driven by a community of developers and designers. We strive to grow together and maintain a faithful continuation of the project.
### Why should I choose Lucide over Feather Icons?
- Lucide already expended the icon set by 130+ in less then a year. Lucide has over 500+ icon, feather sticks around 286 icons.
- Lucide has expanded its icon set by 500+ in the last few years. Lucide now has over 1000 icons, while Feather has around 287 icons.
- Well maintained code base.
- Active community.
### Should I migrate to Lucide?
That depends if you're fine with the icons from feather icons. If that is the case, it is maybe not the effort worth it.
But if you keep wrestling and feel limited by the icons Feather provides you can consider to migrate.
We didn't remove any icons when we forked, but there are some icons renamed.
That depends on whether you're satisfied with the icons from Feather Icons. If that is the case, it may not be worth the effort.
However, if you find yourself struggling and feeling limited by the icons provided by Feather, you can consider migrating.
When we forked, we didn't remove any icons, but some icons have been renamed.

19
icons/monitor-check.json Normal file
View File

@@ -0,0 +1,19 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"running",
"active",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices",
"development"
]
}

16
icons/monitor-check.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m9 10 2 2 4-4" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 337 B

18
icons/monitor-dot.json Normal file
View File

@@ -0,0 +1,18 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"running",
"active",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices",
"development"
]
}

16
icons/monitor-dot.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="19" cy="6" r="3" />
<path d="M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 361 B

View File

@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="20" height="14" x="2" y="3" rx="2" ry="2" />
<line x1="8" x2="16" y1="21" y2="21" />
<line x1="12" x2="12" y1="17" y2="21" />
<path d="M12 13V7" />
<path d="m15 10-3 3-3-3" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 362 B

23
icons/monitor-pause.json Normal file
View File

@@ -0,0 +1,23 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"video",
"movie",
"film",
"suspend",
"hibernate",
"boot",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices",
"multimedia",
"development"
]
}

17
icons/monitor-pause.svg Normal file
View File

@@ -0,0 +1,17 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M10 13V7" />
<path d="M14 13V7" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 356 B

23
icons/monitor-play.json Normal file
View File

@@ -0,0 +1,23 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"video",
"movie",
"film",
"running",
"start",
"boot",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices",
"multimedia",
"development"
]
}

16
icons/monitor-play.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m10 7 5 3-5 3Z" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 338 B

22
icons/monitor-stop.json Normal file
View File

@@ -0,0 +1,22 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"video",
"movie",
"film",
"stop",
"shutdown",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices",
"multimedia",
"development"
]
}

16
icons/monitor-stop.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect x="9" y="7" width="6" height="6" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 352 B

View File

@@ -9,9 +9,9 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="20" height="14" x="2" y="3" rx="2" ry="2" />
<line x1="8" x2="16" y1="21" y2="21" />
<line x1="12" x2="12" y1="17" y2="21" />
<path d="M12 13V7" />
<path d="m9 10 3-3 3 3" />
<path d="M12 13V7" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 361 B

21
icons/monitor-x.json Normal file
View File

@@ -0,0 +1,21 @@
{
"$schema": "../icon.schema.json",
"tags": [
"tv",
"screen",
"display",
"desktop",
"virtual machine",
"vm",
"close",
"stop",
"suspend",
"remove",
"delete"
],
"categories": [
"connectivity",
"devices",
"development"
]
}

17
icons/monitor-x.svg Normal file
View File

@@ -0,0 +1,17 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="m14.5 12.5-5-5" />
<path d="m9.5 12.5 5-5" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<path d="M12 17v4" />
<path d="M8 21h8" />
</svg>

After

Width:  |  Height:  |  Size: 367 B

View File

@@ -3,10 +3,13 @@
"tags": [
"tv",
"screen",
"display"
"display",
"virtual machine",
"vm"
],
"categories": [
"connectivity",
"devices"
"devices",
"development"
]
}

View File

@@ -9,7 +9,7 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="20" height="14" x="2" y="3" rx="2" ry="2" />
<rect width="20" height="14" x="2" y="3" rx="2" />
<line x1="8" x2="16" y1="21" y2="21" />
<line x1="12" x2="12" y1="17" y2="21" />
</svg>

Before

Width:  |  Height:  |  Size: 353 B

After

Width:  |  Height:  |  Size: 346 B

10
icons/move-down-left.json Normal file
View File

@@ -0,0 +1,10 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction"
],
"categories": [
"arrows"
]
}

14
icons/move-down-left.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M11 19H5V13" />
<path d="M19 5L5 19" />
</svg>

After

Width:  |  Height:  |  Size: 261 B

View File

@@ -0,0 +1,10 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction"
],
"categories": [
"arrows"
]
}

14
icons/move-down-right.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M19 13V19H13" />
<path d="M5 5L19 19" />
</svg>

After

Width:  |  Height:  |  Size: 262 B

12
icons/move-down.json Normal file
View File

@@ -0,0 +1,12 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction",
"downwards",
"south"
],
"categories": [
"arrows"
]
}

14
icons/move-down.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 18L12 22L16 18" />
<path d="M12 2V22" />
</svg>

After

Width:  |  Height:  |  Size: 265 B

12
icons/move-left.json Normal file
View File

@@ -0,0 +1,12 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction",
"back",
"west"
],
"categories": [
"arrows"
]
}

14
icons/move-left.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M6 8L2 12L6 16" />
<path d="M2 12H22" />
</svg>

After

Width:  |  Height:  |  Size: 262 B

12
icons/move-right.json Normal file
View File

@@ -0,0 +1,12 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction",
"trend flat",
"east"
],
"categories": [
"arrows"
]
}

14
icons/move-right.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M18 8L22 12L18 16" />
<path d="M2 12H22" />
</svg>

After

Width:  |  Height:  |  Size: 265 B

10
icons/move-up-left.json Normal file
View File

@@ -0,0 +1,10 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction"
],
"categories": [
"arrows"
]
}

14
icons/move-up-left.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M5 11V5H11" />
<path d="M5 5L19 19" />
</svg>

After

Width:  |  Height:  |  Size: 260 B

10
icons/move-up-right.json Normal file
View File

@@ -0,0 +1,10 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction"
],
"categories": [
"arrows"
]
}

14
icons/move-up-right.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M13 5H19V11" />
<path d="M19 5L5 19" />
</svg>

After

Width:  |  Height:  |  Size: 261 B

12
icons/move-up.json Normal file
View File

@@ -0,0 +1,12 @@
{
"$schema": "../icon.schema.json",
"tags": [
"arrow",
"direction",
"upwards",
"north"
],
"categories": [
"arrows"
]
}

14
icons/move-up.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M8 6L12 2L16 6" />
<path d="M12 2V22" />
</svg>

After

Width:  |  Height:  |  Size: 262 B

18
icons/pi-square.json Normal file
View File

@@ -0,0 +1,18 @@
{
"$schema": "../icon.schema.json",
"tags": [
"constant",
"code",
"coding",
"programming",
"symbol",
"trigonometry",
"geometry",
"formula"
],
"categories": [
"development",
"maths",
"shapes"
]
}

16
icons/pi-square.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M7 7h10" />
<path d="M10 7v10" />
<path d="M16 17a2 2 0 0 1-2-2V7" />
</svg>

After

Width:  |  Height:  |  Size: 346 B

17
icons/pilcrow-square.json Normal file
View File

@@ -0,0 +1,17 @@
{
"$schema": "../icon.schema.json",
"tags": [
"paragraph",
"mark",
"paraph",
"blind",
"typography",
"type",
"text",
"prose",
"symbol"
],
"categories": [
"text"
]
}

16
icons/pilcrow-square.svg Normal file
View File

@@ -0,0 +1,16 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M12 12H9.5a2.5 2.5 0 0 1 0-5H17" />
<path d="M12 7v10" />
<path d="M16 7v10" />
</svg>

After

Width:  |  Height:  |  Size: 356 B

View File

@@ -7,7 +7,9 @@
"blind",
"typography",
"type",
"text"
"text",
"prose",
"symbol"
],
"categories": [
"text"

14
icons/play-square.json Normal file
View File

@@ -0,0 +1,14 @@
{
"$schema": "../icon.schema.json",
"tags": [
"music",
"audio",
"video",
"start",
"run"
],
"categories": [
"arrows",
"multimedia"
]
}

14
icons/play-square.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="m9 8 6 4-6 4Z" />
</svg>

After

Width:  |  Height:  |  Size: 290 B

View File

@@ -2,6 +2,8 @@
"$schema": "../icon.schema.json",
"tags": [
"music",
"audio",
"video",
"start",
"run"
],

11
icons/scatter-chart.json Normal file
View File

@@ -0,0 +1,11 @@
{
"$schema": "../icon.schema.json",
"tags": [
"statistics",
"diagram",
"graph"
],
"categories": [
"charts"
]
}

18
icons/scatter-chart.svg Normal file
View File

@@ -0,0 +1,18 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<circle cx="7.5" cy="7.5" r=".5" />
<circle cx="18.5" cy="5.5" r=".5" />
<circle cx="11.5" cy="11.5" r=".5" />
<circle cx="7.5" cy="16.5" r=".5" />
<circle cx="17.5" cy="14.5" r=".5" />
<path d="M3 3v18h18" />
</svg>

After

Width:  |  Height:  |  Size: 430 B

15
icons/sigma-square.json Normal file
View File

@@ -0,0 +1,15 @@
{
"$schema": "../icon.schema.json",
"tags": [
"sum",
"calculate",
"formula",
"maths",
"enumeration",
"enumerate"
],
"categories": [
"text",
"maths"
]
}

14
icons/sigma-square.svg Normal file
View File

@@ -0,0 +1,14 @@
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
>
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M16 8.9V7H8l4 5-4 5h8v-1.9" />
</svg>

After

Width:  |  Height:  |  Size: 303 B

View File

@@ -9,7 +9,7 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M3 7v2a3 3 0 1 1 0 6v2c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2Z" />
<path d="M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z" />
<path d="M13 5v2" />
<path d="M13 17v2" />
<path d="M13 11v2" />

Before

Width:  |  Height:  |  Size: 398 B

After

Width:  |  Height:  |  Size: 396 B

View File

@@ -9,7 +9,7 @@
stroke-linecap="round"
stroke-linejoin="round"
>
<path d="M22 12a9.92 9.92 0 0 0-3.24-6.41 10.12 10.12 0 0 0-13.52 0A9.92 9.92 0 0 0 2 12Z" />
<path d="M22 12a10.06 10.06 1 0 0-20 0Z" />
<path d="M12 12v8a2 2 0 0 0 4 0" />
<line x1="12" x2="12" y1="2" y2="3" />
<path d="M12 2v1" />
</svg>

Before

Width:  |  Height:  |  Size: 383 B

After

Width:  |  Height:  |  Size: 315 B

View File

@@ -30,6 +30,7 @@ declare module 'lucide-vue-next'
// Create interface extending SVGAttributes
export interface SVGProps extends Partial<SVGAttributes> {
size?: 24 | number
strokeWidth?: number
absoluteStrokeWidth?: boolean
}

View File

@@ -35,9 +35,9 @@ Here is a complete example with unpkg
```html
<!DOCTYPE html>
<body>
<i icon-name="volume-2" class="my-class"></i>
<i icon-name="x"></i>
<i icon-name="menu"></i>
<i data-lucide="volume-2" class="my-class"></i>
<i data-lucide="x"></i>
<i data-lucide="menu"></i>
<script src="https://unpkg.com/lucide@latest"></script>
<script>
@@ -49,11 +49,11 @@ Here is a complete example with unpkg
### With ESModules
To reduce bundle size, lucide is built to be fully tree-shakable.
The `createIcons` function will search for HTMLElements with the attribute `icon-name` and replace it with the svg from the given icon name.
The `createIcons` function will search for HTMLElements with the attribute `data-lucide` and replace it with the svg from the given icon name.
```html
<!-- Your HTML file -->
<i icon-name="menu"></i>
<i data-lucide="menu"></i>
```
```js
@@ -89,7 +89,7 @@ createIcons({
'stroke-width': 1,
stroke: '#333'
},
nameAttr: 'icon-name' // attribute for the icon name.
nameAttr: 'data-lucide' // attribute for the icon name.
});
```

View File

@@ -50,9 +50,9 @@ export interface CreateIconsOptions {
/**
* Search HTML emelemt by \`nameAttr\` property.
*
* For example if define \`<i lucide-icon="circle"></i>\`, fill by \`lucide-icon\`.
* For example if define \`<i data-lucide="circle"></i>\`, fill by \`data-lucide\`.
*
* @default 'icon-name'
* @default 'data-lucide'
*/
nameAttr?: string;

View File

@@ -5,7 +5,7 @@ import * as allIcons from './icons';
* Replaces all elements with matching nameAttr with the defined icons
* @param {{ icons?: object, nameAttr?: string, attrs?: object }} options
*/
const createIcons = ({ icons = {}, nameAttr = 'icon-name', attrs = {} } = {}) => {
const createIcons = ({ icons = {}, nameAttr = 'data-lucide', attrs = {} } = {}) => {
if (!Object.values(icons).length) {
throw new Error(
"Please provide an icons object.\nIf you want to use all the icons you can import it like:\n `import { createIcons, icons } from 'lucide';\nlucide.createIcons({icons});`",
@@ -17,10 +17,20 @@ const createIcons = ({ icons = {}, nameAttr = 'icon-name', attrs = {} } = {}) =>
}
const elementsToReplace = document.querySelectorAll(`[${nameAttr}]`);
Array.from(elementsToReplace).forEach((element) =>
replaceElement(element, { nameAttr, icons, attrs }),
);
/** @todo: remove this block in v1.0 */
if (nameAttr === 'data-lucide') {
const deprecatedElements = document.querySelectorAll('[icon-name]');
if (deprecatedElements.length > 0) {
console.warn('[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide');
Array.from(deprecatedElements).forEach((element) =>
replaceElement(element, { nameAttr: 'icon-name', icons, attrs }),
);
}
}
};
export { createIcons };

View File

@@ -83,7 +83,7 @@ const replaceElement = (element: Element, { nameAttr, icons, attrs }: ReplaceEle
const iconAttrs = {
...iconAttributes,
'icon-name': iconName,
'data-lucide': iconName,
...attrs,
...elementAttrs,
};

View File

@@ -1,5 +1,5 @@
// Vitest Snapshot v1
exports[`createIcons > should add custom attributes 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"black\\" stroke=\\"currentColor\\" stroke-width=\\"2\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" icon-name=\\"volume-2\\" class=\\"lucide lucide-volume-2 icon custom-class\\"><polygon points=\\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\\"></polygon><path d=\\"M15.54 8.46a5 5 0 0 1 0 7.07\\"></path><path d=\\"M19.07 4.93a10 10 0 0 1 0 14.14\\"></path></svg>"`;
exports[`createIcons > should add custom attributes 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"black\\" stroke=\\"currentColor\\" stroke-width=\\"2\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" data-lucide=\\"volume-2\\" class=\\"lucide lucide-volume-2 icon custom-class\\"><polygon points=\\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\\"></polygon><path d=\\"M15.54 8.46a5 5 0 0 1 0 7.07\\"></path><path d=\\"M19.07 4.93a10 10 0 0 1 0 14.14\\"></path></svg>"`;
exports[`createIcons > should read elements from DOM and replace it with icons 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" stroke=\\"currentColor\\" stroke-width=\\"2\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" icon-name=\\"volume-2\\" class=\\"lucide lucide-volume-2\\"><polygon points=\\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\\"></polygon><path d=\\"M15.54 8.46a5 5 0 0 1 0 7.07\\"></path><path d=\\"M19.07 4.93a10 10 0 0 1 0 14.14\\"></path></svg>"`;
exports[`createIcons > should read elements from DOM and replace it with icons 1`] = `"<svg xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" viewBox=\\"0 0 24 24\\" fill=\\"none\\" stroke=\\"currentColor\\" stroke-width=\\"2\\" stroke-linecap=\\"round\\" stroke-linejoin=\\"round\\" data-lucide=\\"volume-2\\" class=\\"lucide lucide-volume-2\\"><polygon points=\\"11 5 6 9 2 9 2 15 6 15 11 19 11 5\\"></polygon><path d=\\"M15.54 8.46a5 5 0 0 1 0 7.07\\"></path><path d=\\"M19.07 4.93a10 10 0 0 1 0 14.14\\"></path></svg>"`;

View File

@@ -11,7 +11,7 @@ const getOriginalSvg = (iconName) => {
const svgContent = fs.readFileSync(path.join(ICONS_DIR, `${iconName}.svg`), 'utf8');
const svgParsed = parseSync(svgContent);
svgParsed.attributes['icon-name'] = iconName;
svgParsed.attributes['data-lucide'] = iconName;
svgParsed.attributes['class'] = `lucide lucide-${iconName}`;
return stringify(svgParsed, { selfClose: false });
@@ -19,7 +19,7 @@ const getOriginalSvg = (iconName) => {
describe('createIcons', () => {
it('should read elements from DOM and replace it with icons', () => {
document.body.innerHTML = `<i icon-name="volume-2"></i>`;
document.body.innerHTML = `<i data-lucide="volume-2"></i>`;
createIcons({icons});
@@ -30,11 +30,11 @@ describe('createIcons', () => {
});
it('should customize the name attribute', () => {
document.body.innerHTML = `<i custom-name="volume-2"></i>`;
document.body.innerHTML = `<i data-custom-name="volume-2"></i>`;
createIcons({
icons,
nameAttr: 'custom-name'
nameAttr: 'data-custom-name'
});
const hasSvg = !!document.querySelector('svg');
@@ -43,7 +43,7 @@ describe('createIcons', () => {
});
it('should add custom attributes', () => {
document.body.innerHTML = `<i icon-name="volume-2" class="lucide"></i>`;
document.body.innerHTML = `<i data-lucide="volume-2" class="lucide"></i>`;
const attrs = {
class: 'lucide lucide-volume-2 icon custom-class',
@@ -67,7 +67,7 @@ describe('createIcons', () => {
});
it('should inherit elements attributes', () => {
document.body.innerHTML = `<i icon-name="sun" data-theme-switcher="light"></i>`;
document.body.innerHTML = `<i data-lucide="sun" data-theme-switcher="light"></i>`;
const attrs = {
'data-theme-switcher':'light',