# Button on dashboard

**URL:** https://discourse.nodered.org/t/button-on-dashboard/62068
**Category:** Dashboard
**Tags:** node-red-dashboard
**Created:** [2 May 2022 14:07 UTC](https://discourse.nodered.org/t/button-on-dashboard/62068 "2022-05-02T14:07:56Z")
**Posts on this page:** 1
**Showing post:** 9

<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: [3 May 2022 13:15 UTC](https://discourse.nodered.org/t/button-on-dashboard/62068/9 "2022-05-03T13:15:07Z")

</div>

There is a [thread demonstrating mousedown and mouseup](https://discourse.nodered.org/t/momentary-button-on-dashboard/4906/5) messages.

And my test of it lighting up an led while the button is clicked:

```auto
[{"id":"011e42e065ce8abe","type":"ui_template","z":"b5d64c1e024cd3e1","group":"5f36819feb573bce","name":"","order":1,"width":"0","height":"0","format":"<div class=\"momentary\">\n <md-button> Momentary Button</md-button>\n</div>\n\n<script>\n (function($scope) {\n \n$('.momentary').on('touchstart mousedown', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"payload\": true});\n});\n\n$('.momentary').on('touchend mouseup', function(e) {\n e.preventDefault(); //prevent default behavior\n $scope.send({\"payload\": false});\n});\n \n})(scope);\n</script>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":320,"y":140,"wires":[["feffe07cd1f9b458"]]},{"id":"7fda98f6f1f98db6","type":"inject","z":"b5d64c1e024cd3e1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":140,"wires":[["011e42e065ce8abe"]]},{"id":"feffe07cd1f9b458","type":"ui_led","z":"b5d64c1e024cd3e1","order":1,"group":"5f36819feb573bce","width":"1","height":"1","label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"true","valueType":"bool"},{"color":"#008000","value":"false","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":470,"y":140,"wires":[]},{"id":"5f36819feb573bce","type":"ui_group","name":"Delta","tab":"dbf999e51b777958","order":8,"disp":true,"width":"6","collapse":false,"className":""},{"id":"dbf999e51b777958","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

_[View the full topic](https://discourse.nodered.org/t/button-on-dashboard/62068)._
