# Button icon does not update/refresh automatically

**URL:** https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099
**Category:** Dashboard
**Tags:** node-red-dashboard, function-node
**Created:** [1 October 2024 11:44 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099 "2024-10-01T11:44:07Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![waquete](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@waquete](https://discourse.nodered.org/u/waquete)
#### Post date: [1 October 2024 11:44 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/1 "2024-10-01T11:44:07Z")

</div>

Hello,

I have set a dashboard button that I just use to display an icon (iconify).

icon and color is sent by msg.ui\_control:

```auto
var msg2 = {};
if (msg.payload.state == "OFF") {
    msg2.ui_control = { "icon" : "iconify-bi-ev-front 32px", "color" : "grey" }    
} else if ((msg.payload.state == "ON") && (msg.payload.power_apparent >1000)) {
    msg2.ui_control = { "icon" : "iconify-bi-ev-front-fill 32px", "color" : "lime" }    
} else {
    msg2.ui_control = { "icon" : "iconify-bi-ev-front 32px", "color" : "green" }    
}
return msg2;

```

Inside the button settings, I have set:  
icon : {{icon}}  
color : {{color}}

if I change the icon, the new one is shown only if I refresh the browser (like F5).  
if I don't, the button will just keep previous icon.

Did I missed something ? How can I 'force' icon change, without refreshing the whole dashboard ?

---

<div class="post-metadata">

### Author: ![waquete](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@waquete](https://discourse.nodered.org/u/waquete)
#### Post date: [1 October 2024 11:50 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/2 "2024-10-01T11:50:17Z")

</div>

now I can see "on refresh" for ui\_button icon here:

> <https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md>

but still I wonder: is there a way for button refresh only ?

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [1 October 2024 11:53 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/3 "2024-10-01T11:53:22Z")

</div>

It was quite of time ago the iconify icons introduced to dashboard 1.0 but I do remember there was a challenge to get them working and it took to have duplicate set of elements and then the switching was possible between those.  
Direct replacing was not possible. I don't think that anything is changed since then. So I really doubt it is possible to have dynamic icons with Iconify icons.

---

<div class="post-metadata">

### Author: ![waquete](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@waquete](https://discourse.nodered.org/u/waquete)
#### Post date: [1 October 2024 12:04 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/4 "2024-10-01T12:04:22Z")

</div>

mm good to know, following your message, I tried with non-iconify icons:

either sending (with a couple of inject buttons) :

```auto
msg.ui_control = {'icon' : "thumb_up"};
return msg;

```

or

```auto
msg.ui_control = {'icon' : "thumb_down"};
return msg;

```

it's same issue: no update except if I refresh the full page (F5).  
so it may be not related to iconify ?

Edit : I tried changing only color : same issue

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [1 October 2024 12:10 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/5 "2024-10-01T12:10:27Z")

</div>

Well as the "config-fields" document says - for button there is refresh required. So no support what so ever.  
But what I tried to say is that Iconify is much trickier to handle and dynamics with them is hard or impossible to achieve with the dashboard widgets.

You may get some results if you try with the ui\_template where you can figure out logic which is aligned with the iconify strategies.

I don't have a computer with DB1 installed nearby so can't even try out.

---

<div class="post-metadata">

### Author: ![waquete](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@waquete](https://discourse.nodered.org/u/waquete)
#### Post date: [1 October 2024 12:19 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/6 "2024-10-01T12:19:23Z")

</div>

Thank you for your feedback.

Well, I have a possible workaround in this situation as I use the button as a telltale (I don't need the button function, but it was an easy way to show an icon).

For some other stuff, I have use [ui\_svg](https://flows.nodered.org/node/node-red-contrib-ui-svg) which can dynamically change it's svg display.  
Good point is that iconify icons _are_ svg, so I can simply use the `<svg>` code from iconify website to inject in ui\_svg node.

Still, it's a bit curious that we can dynamically change icons/colors of dashboard switches, but not button (even non iconify)

---

<div class="post-metadata">

### Author: ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)
#### Post date: [1 October 2024 12:20 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/7 "2024-10-01T12:20:28Z")

</div>

> [@hotNipi](#):
>
> and it took to have duplicate set of elements and then the switching was possible between those.

That was the solution for the switch node

---

<div class="post-metadata">

### Author: ![waquete](https://avatars.discourse-cdn.com/v4/letter/w/a698b9/32.png) [@waquete](https://discourse.nodered.org/u/waquete)
#### Post date: [1 October 2024 12:24 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/8 "2024-10-01T12:24:27Z")

</div>

> [@hotNipi](#):
>
> hem working and it took to have duplicate set of elements and then the switching was possible between those.  
> Direct replacing was not possible. I don't think that anything is changed sinc

didn't tried iconify on switchs, but dynamic change works very well with material icons.  
 ![Capture d’écran du 2024-10-01 14-23-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f83c0838c101a5b81db17c0b3212dcc160eddf39.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [31 October 2024 12:25 UTC](https://discourse.nodered.org/t/button-icon-does-not-update-refresh-automatically/92099/9 "2024-10-31T12:25:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
