You can do it as described here.
Example for button2:
[{"id":"017b802aae874bc4","type":"debug","z":"b6c46bbc8cfc81cb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":770,"y":220,"wires":[]},{"id":"fe8deaee5c60fbad","type":"ui_svg_graphics","z":"b6c46bbc8cfc81cb","group":"c20e25fb6de0c5b9","order":1,"width":0,"height":0,"svgString":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:bx=\"https://boxy-svg.com\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" viewBox=\"0 0 1000 700\" width=\"1000\" height=\"700\" preserveAspectRatio=\"xMidYMid meet\">\n <rect id=\"svgEditorBackground\" x=\"0\" y=\"0\" width=\"500\" height=\"500\" style=\"fill:none;stroke:none;\" />\n <rect style=\"fill: rgb(255, 255, 255); stroke: rgb(0, 0, 0);\" x=\"-79.533200\" width=\"409.529000\" height=\"242.384000\" rx=\"25\" ry=\"25\" y=\"153.757000\" bx:origin=\"0.5 0.499805\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"fill: rgb(216, 216, 216); stroke: rgb(0, 6, 90);\" cx=\"123.476000\" cy=\"308.898000\" r=\"30.000000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <path d=\"M19.008435-20.089736H65.025435L65.025435-23.935736L71.703435-18.807736L65.025435-13.679736L65.025435-17.525736H19.008435V-20.089736Z\" style=\"stroke: rgb(0, 24, 97); fill: rgb(0, 24, 97);\" transform=\"matrix(1.53463 -1.64542 1.42205 1.77413 483.344 527.993)\" bx:shape=\"arrow 110.407 66.237 52.695 10.256 2.564 6.678 0 1@fa8cf3b1\" id=\"selectorSwitch\" />\n <text style=\"fill: rgb(92, 22, 22); font-family: Arial, sans-serif; font-size: 10.2px; white-space: pre;\" transform=\"matrix(1.97176 0 0 2.27961 316.859 -220.896)\">\n <tspan x=\"85.3796\" y=\"233.882\">*Selector </tspan>\n <tspan x=\"85.3796\" dy=\"1em\">​</tspan>\n <tspan> switch</tspan>\n </text>\n <circle style=\"fill: rgb(110, 114, 110); stroke: rgb(0, 0, 0);\" cx=\"-16.145800\" cy=\"332.809000\" r=\"27.759000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill: rgb(195, 191, 195);\" cx=\"-16.185800\" cy=\"332.632000\" r=\"25.531000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill: rgb(69, 255, 1);\" cx=\"-16.261800\" cy=\"333.180000\" r=\"24.576000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" id=\"button2\" />\n <circle style=\"fill: rgb(110, 114, 110); stroke: rgb(0, 0, 0);\" cx=\"-16.145800\" cy=\"210.809000\" r=\"27.759000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill: rgb(195, 191, 195);\" cx=\"-16.185800\" cy=\"210.632000\" r=\"25.531000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill:green;\" cx=\"-16.261800\" cy=\"211.180000\" r=\"24.576000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" id=\"button1\" />\n <circle style=\"fill: rgb(110, 114, 110); stroke: rgb(0, 0, 0);\" cx=\"266.758000\" cy=\"332.483000\" r=\"27.759000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill: rgb(195, 191, 195);\" cx=\"266.718000\" cy=\"332.306000\" r=\"25.531000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" />\n <circle style=\"stroke: rgb(0, 0, 0); fill: rgb(65, 159, 31);\" cx=\"266.642000\" cy=\"332.854000\" r=\"24.576000\" transform=\"matrix(2.25 0 0 2.25 248.065 -273.5)\" id=\"button3\" />\n <path d=\"M187.579844-9.752301H233.596844L233.596844-13.598301L240.274844-8.470301L233.596844-3.342301L233.596844-7.188301H187.579844V-9.752301Z\" style=\"stroke: rgb(0, 24, 97); fill: rgb(0, 24, 97); visibility: hidden;\" transform=\"matrix(-1.61839 -1.56311 1.79867 -1.39087 887.132 743.994)\" bx:shape=\"arrow 110.407 66.237 52.695 10.256 2.564 6.678 0 1@fa8cf3b1\" />\n</svg>","clickableShapes":[],"javascriptHandlers":[{"selector":"#button1","action":"click","sourceCode":"if (this.style.fill == \"rgb(69, 255, 1)\") {\n $scope.send({payload: 1, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(255, 0, 0)\";\n}\nelse {\n $scope.send({payload: 0, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(69, 255, 1)\";\n}"},{"selector":"#button2","action":"click","sourceCode":"if (this.style.fill == \"rgb(69, 255, 1)\") {\n $scope.send({payload: 1, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(255, 0, 0)\";\n}\nelse {\n $scope.send({payload: 0, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(69, 255, 1)\";\n}"},{"selector":"#button3","action":"click","sourceCode":"if (this.style.fill == \"rgb(69, 255, 1)\") {\n $scope.send({payload: 1, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(255, 0, 0)\";\n}\nelse {\n $scope.send({payload: 0, topic: \"BUTTON_3\"});\n this.style.fill = \"rgb(69, 255, 1)\";\n}"}],"smilAnimations":[],"bindings":[],"showCoordinates":false,"autoFormatAfterEdit":true,"showBrowserErrors":false,"showBrowserEvents":false,"enableJsDebugging":false,"sendMsgWhenLoaded":false,"noClickWhenDblClick":false,"outputField":"payload","editorUrl":"//drawsvg.org/drawsvg.html","directory":"","panning":"disabled","zooming":"disabled","panOnlyWhenZoomed":false,"doubleClickZoomEnabled":false,"mouseWheelZoomEnabled":false,"dblClickZoomPercentage":150,"cssString":"div.ui-svg svg{\n color: var(--nr-dashboard-widgetColor);\n fill: currentColor !important;\n}\ndiv.ui-svg path {\n fill: inherit !important;\n}","name":"","x":590,"y":220,"wires":[["017b802aae874bc4"]]},{"id":"d920d647bde88581","type":"inject","z":"b6c46bbc8cfc81cb","name":"Button 2 green","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"update_style\",\"selector\":\"#button2\",\"attributeName\":\"fill\",\"attributeValue\":\"rgb(69, 255, 1)\"}","payloadType":"json","x":360,"y":200,"wires":[["fe8deaee5c60fbad"]]},{"id":"ae89562cf6b6dc5c","type":"inject","z":"b6c46bbc8cfc81cb","name":"Button 2 red","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"command\":\"update_style\",\"selector\":\"#button2\",\"attributeName\":\"fill\",\"attributeValue\":\"rgb(255, 0, 0)\"}","payloadType":"json","x":370,"y":240,"wires":[["fe8deaee5c60fbad"]]},{"id":"c20e25fb6de0c5b9","type":"ui_group","name":"Racking Remote","tab":"a28ff08f.3a822","order":1,"disp":true,"width":"30","collapse":false,"className":""},{"id":"a28ff08f.3a822","type":"ui_tab","name":"SVG","icon":"dashboard","order":38,"disabled":false,"hidden":false}]