Skip to the content.

AutoWidthLabelGenerator component

This component will generate the necessary Power Apps code to have your applications’ labels Width adapt automatically to their content, whatever the font, the font weight or the font size.

AutoWidthLabelGenerator

This little trick will allow you, at last, to have good-looking breadcrumbs with nice icons in-between each level moving along with the length of each level’s text. It will also allow you to have tabs in any language where your buttons will stick together and expand whatever the language.

AutoWidthLabelGenerator

Here is how the label auto-sizes itself directly inside the Power Apps Studio:

AutoWidthLabelGenerator

Component properties

This component doesn’t have any properties as it is standalone and can be used right away.

Important notes

How it works

The component holds an internal collection with the unitary width of each of the 255 characters in the latin ASCII table (well in fact from 32 to 255). And this for each Power Apps font and each font weight. A label’s Width property in your app will have a small formula that will use a portion of this collection to calulate the size of the label’s Text property. The portion of collection that will be needed in your app will be inserted in its OnStart event. Its content will depend on the fonts and font-weights you plan to use within your app’s labels. Then just placing a little formula into your label’s Width property will do the trick.

Updates