Skip to content

Support passing a custom root element to createIcons #3537

@jh0ker

Description

@jh0ker

Package

  • lucide
  • lucide-angular
  • lucide-flutter
  • lucide-preact
  • lucide-react
  • lucide-react-native
  • lucide-solid
  • lucide-svelte
  • lucide-vue
  • lucide-vue-next
  • lucide-astro
  • Figma plugin
  • all JS packages
  • site

Description

When calling lucide.createIcons, I'd like to have the ability to specify a custom root element, so that only a specific part of the DOM tree is searched for potential icons needing to be created. Currently, it will always search the entire document, even if it's known that only a small part of the page needs to be searched.

While the performance impact of this is probably not very large in most cases, this seems like a low-hanging fruit to avoid doing a whole bunch of unnecessary computational work on bigger pages with lots of DOM nodes.

Use cases

I'm working on a website using HTMX and Alpine, which regularly update the DOM. Currently, after any update that potentially adds an icon to the page, I need triggers that run createIcons on the entirety of the page, even if I know that only a small part of the DOM could have been updated (e. g. a notification or modal).

I believe this would be relevant to anyone building interactive websites using similar technologies, or even old-school PHP/AJAX style architectures.

Checklist

  • I have searched the existing issues to make sure this bug has not already been reported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions