feat(packages/lucide): added support for providing a custom root element (#3543)

* feat(packages/lucide): added support for providing a custom root element

* feat(packages/lucide): ran prettier & renamed from root ⇒ context
This commit is contained in:
Karsa
2025-08-18 15:25:08 +02:00
committed by GitHub
parent f8a1a76b83
commit 85dba80322
3 changed files with 33 additions and 7 deletions
+7 -2
View File
@@ -88,7 +88,11 @@ createIcons({
### Additional Options
In the `createIcons` function you can pass some extra parameters to adjust the `nameAttr` or add custom attributes like for example classes.
In the `createIcons` function you can pass some extra parameters:
- you can pass `nameAttr` to adjust the attribute name to replace for
- you can pass `attrs` to pass additional custom attributes, for instance CSS classes or stroke options.
- you can pass `root` to provide a custom DOM element the icons should be replaced in (useful when manipulating small sections of a large DOM or elements in the shadow DOM)
Here is a full example:
@@ -101,7 +105,8 @@ createIcons({
'stroke-width': 1,
stroke: '#333'
},
nameAttr: 'data-lucide' // attribute for the icon name.
nameAttr: 'data-lucide', // attribute for the icon name.
root: element, // DOM element to replace icons in.
});
```