Shorten/Increase text box based on length of text

Hi there,

Is there a way to increase or decrease the width of a text box based on how long the text is… Kind of like how in the iOS messaging text background?