Skip to content

Button ui-button ​

Try Demo

Adds a clickable button to your dashboard.

Properties ​

PropDynamicDescription
GroupDefines which group of the UI Dashboard this widget will render in.
SizeControls the width of the button with respect to the parent group. Maximum value is the width of the group.
Icon✓Renders a Material Design icon within the button. There is no need to include the "mdi-" prefix.
Icon Position✓If "Icon" is defined, this property controls which side of the "Label" the icon will render on.
Label✓The text shown within the button. If not provided, then the button will only render the icon.
Button Color✓Button Color. If not provided, default theme color will be used.
Text Color✓Text (Label) color. If not provided calculated automatically based on Button color to be Black or White.
Icon Color✓Icon color. If not provided, will have the same color as text / label.
Enable pointerup eventEnables the capturing of pointerup events on the button. The output will contain msg._event which details the type of interaction causing the event.
Enable pointerdown eventEnables the capturing of pointerdown events on the button. The output will contain msg._event which details the type of interaction causing the event.
Enable click eventEnables the capturing of click events on the button, i.e.g when both the pointerdown and pointerup events occur whilst the mouse stays inside the button. The output will contain msg._event which details the type of interaction causing the event.
Emulate Button ClickIf enabled, any received message will trigger a button click, emitting the relevant payload and topic.

Dynamic Properties ​

Dynamic properties are those that can be overriden at runtime by sending a particular msg to the node.

Where appropriate, the underlying values set within Node-RED will be overriden by the values set in the received messages.

PropPayloadStructuresExample Values
Iconmsg.ui_update.iconString
Icon Positionmsg.ui_update.iconPositionString
Labelmsg.ui_update.labelString
Button Colormsg.ui_update.buttonColorString
Text Colormsg.ui_update.textColorString
Icon Colormsg.ui_update.iconColorString
Classmsg.ui_update.classString

Controls ​

msg.ExampleDescription
enabledtrue | falseAllow control over whether or not the button is clickable.

Example ​

Simple Button ​

Example of a ButtonExample of a rendered button in a Dashboard.

Measuring Hold Duration ​

It's possible to configure a button to emit pointerdown and pointerup events. With this, it's possible to measure how long a button is held down for.

The flow to achieve this demo is as follows: