Based on text content increase container size

For my game, I am using new Unity UI. I have question regarding this.

I want to increase my container size based on more number of characters enter into text area.
So based on text, I want to increase container size. Following image represent my question clearly.

54726-screen-shot-2015-09-21-at-83754-pm.png

Please give me your suggestion.

You should use Content Size Filter along with Horizontal Layout Group. For this follows the following steps:

  • Add CanvasImage (Container of your text)
  • Add Text and make it child of Image
  • Add Content Size Filter and Horizontal Layout Group components to Image
  • Select preferred size in both Horizontal fit and Vertical fit fields in Content Size Filter

54776-screen-shot-2015-09-22-at-43710-pm.png

Hope this helps