The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
How should I use icons? I want to use icons on my website but the catch is I want them conditional like I want to add social links and I only want icons I’ve in the state like:
But I want if I’ve to add/remove a social link I haven’t to add it manually in code but simply change it in the state.
Like I can do that using font awesome library like:
But this is the ugly method of loading the whole CDN library and the other method is I simply add svg code here still looks bad and prohibited in docs that state size shouldn’t be big.
What’s your workaround here?
mburridge3
Hi @inamkbmail
Thanks for your enquiry and apologies for the delay in responding. We’ll investigate possible options and get back to you soon.
inamkbmail4
ok let me know about that
mburridge6
Hi @inamkbmail
Here’s a couple of approaches. Font Awesome allows you to create subsets of icons to reduce file size and even just import the icons you need into your project. Take a look at:
TY for help.
I wanted something like dynamic imports for icons based on theme config in index.js.
I found https://react-icons.netlify.com/ very helpful.
But idea like dynamic imports isn’t cool now.