Automatically Resize a TextField so that it's boundries don't go beyond it's text

I’m using text fields for buttons right now, and I know how to set their length and width, but I was wondering if it was possible to dynamically resize them based on the text contained? (The buttons change, like Play/Pause but with more variation of length)

-Thanks