Import icons selected from backend


Is there any way to import IonIcons from a variable?

In my backend, I should have the option to define an icon for every category, and then the app should fetch the categories and their icons, import them, and show them.

It might be better to globally register the icons and reference to them using the string names. Adding a handful of icons globally won’t significantly increase your bundle size.

This example shows you how to do it: Ionic Vue Quickstart - Ionic Documentation

From there, you can pass in the string name of the icon based on some condition inside of your application.

Thanks for the reply. I’ll see how many icons I can add while keeping a “normal” bundle size.