How to position button relative to canvas?

hello all,
How can I position button(using createButton()) relative to canvas? with button.position() I can position the button on the canvas area, but I wanted to know whether there is a way to change button position when the canvas position or its size changes?

thank you

You probably should use CSS and depending on your project even build the controls within the html-file to have easier control over the structure / layout.