Responsiveness of a Group

Hello, I am kinda new in this, how can we make a group width dynamic to text inside it, that group consists of text box and icon (like if text inside group is small the width of group is small and if text inside group is large it is large) ? I am blocked at a point because of this, help is appreciated.
Thankyou

Regards,
Shubham Desai