How to change the size of an element by text size


I would like to know how to change the size of an element (rectangle) by the content size of text in it. Thank you.

This is default like PCs:

After resizing the browser like smartphones:

I want it to be like this: (26.7 KB)

Hype uses fixed height and position. So if you have a string you can layout your box to your needs in the GUI while creating it.

If you want to use a dynamic string you are already using JS to replace content so you would need to also change the height of the modal box by script. Use the command hypeDocument.setElementProperty and set height base on content length.

A hint to avoid positioning the button. Use a group for sizing everything and use the stretch an positioning pins for the elements inside the group like the button (bottom, center) and background (edge to edge pinned).

Thanks. I will give it a try.