How do you autosize a button to the contained TextBlock

I was wondering how you can set a button to the width and height of the button’s textblock.
I have used adaptWidthToChildren = true but that would basically create a fullscreen button.
Here is a playground:

Any ideas?

Thanks a lot.

I played a bit with your PG and came to the following solution:

I used


method to do that, but have to say that I am really not that into HTML and webtech :sweat_smile: so you may tweak the code for your needs! :relaxed:

Can’t find any other way to do it via the Babylon.GUI yet…maybe it would be nice if our TextBlock-Class provides a matching property for this stuff (like GetMeasure or something like that, I have found a _currentMeasures field in the source but was too stupid to use it) :thinking:

1 Like

thank you.
haha, well webtech is not my favourite as well to say the least :slight_smile: