# TextWithIcon

## When to use?

If you want to replace icon with text in 1 like and make sure composition always in center of rect or frame. Each position depends on text preffered size runtime.

<figure><img src="https://1613353771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fygjewtla1W7kzTTIpGWq%2Fuploads%2FjxaxBLIJTIsFPQFkFkEb%2Fimage.png?alt=media&#x26;token=d7833d58-1953-4f1f-80bb-7402c9814007" alt=""><figcaption><p>Example how it work</p></figcaption></figure>

## How to use

* Replace Text and Image in center of button or rect;\
  \&#xNAN;*<mark style="color:red;">Make sure that text aligh is left or right, not center!</mark>*
* TextWithIcon is generic class. Declare TextWithIcon field in UI controller;
* Init component by Init() function in Awake or when UI enables once;
* Change text like with Text.cs by text property.
