Horizontal spacing between elements issue

I have got this title and a button right next to it. When I insert them both into a container with a grid, the title shrinks and a new line is being created for the text to fit into the grid’s cell. Honestly, I generally struggle making these two elements stick together at the right side of my header.

Any example would be appreciated!

you can set the first column on the grid to max content. (you can change it on the inspector panel)
then set the text width to 100% (make sure the text is on the first column)

Hi, thank you so much!
May I ask one more thing, what if I have another element in the middle of the header? A logo on the right edge, a search bar in the middle, then the text & the red button on the left edge. Is it complex to make them all work together without overlapping?

Thank you!