Change icon based on condition

Hi there,

I am able to change an icon based dynamically binding a formula to it, but then I need to add the technical name of the icon in the if else expression. Is there also a method to change an icon dynamically, by selecting a icon from the icon set when a condition is true or false?

Yup. That’s what element states are for!

1 Like

Hi @FJP84 :wave:

Depending on your use case, you might not even need states.

The example below is silly but it says that if 1=1, the icon should be the star, otherwise, it should be the checkbox":

Two things that are important to note:

  1. the name of the icon should be a string, so in between quotes like in the example above
  2. you’ll need to choose an icon and find its name before you can reference it. you can see it’s name here when it’s on the page:

Thanks Joyce, your method was the one I already use. I was curious if it is possible to select an icon instead of typing the name.

1 Like

Ah ok sorry. I read too fast! Then @jaredgibb’s recommendation seems to be what you’re looking for :slight_smile:

1 Like