Deal with custom icons in TS
See original GitHub issueFollowing the guide to add custom icons I get an TypeScript eror that the name is not assignable.
<Icon name="custom-icon" size="20px" color="gray.400" />
Type '"custom-icon"' is not assignable to type '"link" | "time" | ...
Is there a ways to override the export type Icons ..
?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (7 by maintainers)
Top Results From Across the Web
How To Use Custom SVG Icons in Angular Material
In order to use the default Material Icons, you'll need to first import them in the global stylesheet. To do this, open the...
Read more >Custom Icons with Ionic 5? - Stack Overflow
You need to remove the md- from the icon name. For example, your icon is md-my-custom-icon.svg. Change to my-custom-icon.svg .
Read more >How you're dealing with hundreds of custom icons which ...
Currently I'm working with team which designer provides the icons and all of them custom which means I can't use any icon package...
Read more >Build your own icon library in Angular part 1/4 - YouTube
In this part, we will first explore how FontAwesome delivers their SVG icons library. We will then visualize their concept and show you ......
Read more >How to create an icon library in Angular - Medium
The first thing we need to do is to refactor our dinosaur-icons.ts from one object to multiple constants. Having multiple constants allows us...
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
@tony (and future others who’ll face this)
this is what I do instead, without the need to load the full CDN (also tree shaking works 😃 )
A more “chakra-y” way
–
Each Font Awesome react icon is an IconDefinition which has the following format
So based on that data, I created a helper function which in conjunction with chakra’s createIcon helper, it accepts an
IconDefinition
and spits out a supported element to use with chakra’sIcon
Example
pinging @segunadebayo about this. Is it worth adding a better version of this snippet in your docs (or even better, provide an official adapter) for react-fontawesome users? FA is being used by lots and lots of people and I’m pretty sure that many will find it super useful
In my situation, I opted to use font awesome bundles from CDN
There isn’t an easy way to do this with
Icon
, but here’s what I did: