Dynamic button tooltip


#1

Hi,

Is there a way to set the button tooltip by sending it a message? If not, how hard is it to create a custom button node with this capability?


#2

hmm - not sure - you could try via - https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md
The tooltip capability was added after that feature was added so it may just work despite not being mentioned in the docs... If you try it and it works please let us know and we can update the docs. (or indeed if it doesn't)


#3

I wasn't able to get ui_control to work at all. I injected into the function below, and connected it to the button input. It didn't do anything.

msg.ui_control = { "color": "red" }
return msg;


#4

I thought this was about tooltip ?
color can be set by any msg property by setting the field to {{msg.propertyname}}


#5

Sorry. I should have led with "tooltip didn't work". After that I tried one of the properties that was documented to work. That didn't work either so I have to assume that I'm not trying to set it properly. No example was included in the documentation. Even if toolltip never works, maybe you can update the documentation to include an actual example of how to use ui_control.


#6

I've switched from a button to a template node and I'm able to get the dynamic tooltip working.


#7

I just checked and send a msg into a button with msg.ui_control set to { "tooltip":"Hello World" } then it will update the tooltip... but only on refresh. So it is dynamic in that it can be set programatically - but you need to refresh for the config to be re-read.
Using the template as you have done would allow instant updates so may suit your application better.


#8

I was able to get that to work. Thanks for your help.