# Dynamically change label of ui-switch

**URL:** <https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911>\
**Category:** General\
**Tags:** dashboard\
**Created:** [10 July 2022 15:54 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911 "2022-07-10T15:54:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Olivier](https://avatars.discourse-cdn.com/v4/letter/o/d2c977/32.png) [@Olivier](https://discourse.nodered.org/u/Olivier)\
**Post date:** [10 July 2022 15:54 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/1 "2022-07-10T15:54:37Z")

</div>

Hello,  
Despite the help, that tells:  
The label can also be set by a message property by setting the field to the name of the property, for example `{{msg.topic}}` .

I'm not able to change dynamically the label.

I've tried to send a message with msg.label, msg.Label, msg.payload.label, etc.... but the label doesn't change.

Any ideas ?

Thanks for your support

Olivier

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [10 July 2022 16:46 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/2 "2022-07-10T16:46:47Z")

</div>

Hi Olivier.

It works for me using {{msg.payload}} (or any other property of msg).

What version of Node-red do you have, what platform?  
What version of node-red-dashboard?

---

<div class="post-metadata">

**Author:** ![Olivier](https://avatars.discourse-cdn.com/v4/letter/o/d2c977/32.png) [@Olivier](https://discourse.nodered.org/u/Olivier)\
**Post date:** [11 July 2022 05:15 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/3 "2022-07-11T05:15:02Z")

</div>

Hello,

My version is 2.1.4 running on a Synology NAS  
Dashboard is 3.1.7

I’ve tried to send the message via an inject node

 ![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/4/d4264cb16f7754f5cd47a4699c8c544464b7097c.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [11 July 2022 05:24 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/4 "2022-07-11T05:24:37Z")

</div>

Dumb question:

Have you _told_ that node to use...... `{{msg.whatever}}` to be the label?

Open the `ui-switch` node and take a screen shot, or export the node and post it.

If you do a screen shot, before you post it, crop out all the other stuff so only the node's edit window is in the shot. (Makes it better to see when you post it)

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 July 2022 12:50 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/5 "2022-07-11T12:50:58Z")

</div>

" The label can also be set by a message property by **setting the field to the name of the property** , for example `{{msg.topic}}`."

 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/7/57d3a098cb1c086763b6130516ba2cd8be66c029.jpeg)

---

<div class="post-metadata">

**Author:** ![Olivier](https://avatars.discourse-cdn.com/v4/letter/o/d2c977/32.png) [@Olivier](https://discourse.nodered.org/u/Olivier)\
**Post date:** [11 July 2022 15:06 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/6 "2022-07-11T15:06:38Z")

</div>

thanks,  
was not clear for me that I've to put in the label field of the properties the field of the message that allow to change the label.  
Thanks again  
Olivier

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [11 July 2022 18:18 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/7 "2022-07-11T18:18:40Z")

</div>

I think the help text could be more clearly worded to reflect the use of squiggly brackets, or at least with a link to a comprehensive explanation of {...}, {{...}} And even {{{...}}}.

Good grief that was hard to type on my phone!

---

<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:** [25 July 2022 18:19 UTC](https://discourse.nodered.org/t/dynamically-change-label-of-ui-switch/64911/8 "2022-07-25T18:19:38Z")

</div>

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