Change icon import names to have a prefix e.g. <LucideCamera />
See original GitHub issueIt’s not all the time I run into this issue but I often find myself having to use different icons or renaming components within React projects so that they don’t clash with the imports.
E.g. if I want to use <Login />
Lucide icon but I have a <Login />
functional component.
A suggestion would be to prefix the imports so <Camera />
would become <LcCamera />
or similar.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Issues · lucide-icons/lucide - GitHub
Beautiful & consistent icon toolkit made by the community. ... Change icon import names to have a prefix e.g. <LucideCamera /> bug Something...
Read more >Import Icons | Font Awesome Docs
Here's a primer on Font Awesome icon naming and how to import from icon ... 1) Font Awesome specific style prefix (e.g. fa-solid...
Read more >How to find Icon names for Font Awesome to import with React?
When you click on an icon you'll see the icon name, e.g. 'arrow-circle-left' but in order to use it like in your above...
Read more >Docs - IcoMoon
To edit an icon, use the edit/pencil button and then click on an icon cell. ... If you import an SVG font, the...
Read more >How to use react-icons to install Font Awesome in a React app
Render the icon name as a React element. Code example. import React, { Component } from 'react' ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have a plan to support aliases in all our packages that uses lucide icons as components. I was thinking to add an aliases.js file with all the icons aliases. and export them in the main index.ts.
import { Camera } from "lucide-react";
or `import { CameraIcon } from “lucide-react”; will lead to the same icon file. This only will working nicely with ESModules.If you want to have all the icons you can then still do
import * as icons from "lucide-react/icons";
But importing icons this way is not recommended and bad practice if you are bundeling your application for browsers. This way of importing breaks the tree-shaking ability in bundlers. So your bundled app will include all 800+ icons.Another way you could do it is to import as
and then render components as
I think namespacing imports properly should be the responsibility of the app developer, not the library developer, and therefore disagree that this is something that needs a solution from Lucide’s or @ericfennis’ end.