How to render a momentary pushbutton in a custom resource (java script)

I have an ESPButton that I wish to render in a custom UI element - I’ve based it on the WireCard.js in the documentation

It looks like this

The right hand toggle is a ESPButton - So that is a momentary , I’ve no previous javascript experience, can someone point to something I can plagiarise?