mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-14 13:58:21 +00:00
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:
@@ -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.
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user