Difference between label, expression and text widget.

Hi All,

Till now I was thinking that Label is similar to Text widget and very different from expression widget which gives us dynamic value. One of my friend today showed me how it is wrong, because Label also takes expression as an input.

  

Now my question is what is the difference between text, label and expression widget and when to use which widget.


Regards,

Ankita 

Ankita Kulkarni wrote:

Hi All,

Till now I was thinking that Label is similar to Text widget and very different from expression widget which gives us dynamic value. One of my friend today showed me how it is wrong, because Label also takes expression as an input.

  

Now my question is what is the difference between text, label and expression widget and when to use which widget.


Regards,

Ankita 


Hi Ankita,


I found a similar post so I am sharing with you for you also,


https://www.outsystems.com/forums/discussion/51087/label-vs-text-vs-expression/


Hi,


Both labels and text can be used as captions to input widgets. But labels have better usability compared to text. Labels have a property to associate it with an input widget. When you click on the label the focus is moved to the associated input widget. 

Text widget displays a static text in the UI

The expression widget allows you to display dynamic text based on the expression value. and also help to translate HTML content using escape property.


I hope that will help you.

JitendraYadav wrote:

Hi,


Both labels and text can be used as captions to input widgets. But labels have better usability compared to text. Labels have a property to associate it with an input widget. When you click on the label the focus is moved to the associated input widget. 

Text widget displays a static text in the UI

The expression widget allows you to display dynamic text based on the expression value. and also help to translate HTML content using escape property.


I hope that will help you.

Hi Jitendra, 

Thank you for the information. In the following ss you can see one is done by expression and other is done by label. Can you let me know whenshould I prefer label and when expression 


Ankita Kulkarni wrote:

JitendraYadav wrote:

Hi,


Both labels and text can be used as captions to input widgets. But labels have better usability compared to text. Labels have a property to associate it with an input widget. When you click on the label the focus is moved to the associated input widget. 

Text widget displays a static text in the UI

The expression widget allows you to display dynamic text based on the expression value. and also help to translate HTML content using escape property.


I hope that will help you.

Hi Jitendra, 

Thank you for the information. In the following ss you can see one is done by expression and other is done by label. Can you let me know whenshould I prefer label and when expression 


Hi,


As per my understanding expression is better in this case.


Thanks!


JitendraYadav wrote:

Ankita Kulkarni wrote:

JitendraYadav wrote:

Hi,


Both labels and text can be used as captions to input widgets. But labels have better usability compared to text. Labels have a property to associate it with an input widget. When you click on the label the focus is moved to the associated input widget. 

Text widget displays a static text in the UI

The expression widget allows you to display dynamic text based on the expression value. and also help to translate HTML content using escape property.


I hope that will help you.

Hi Jitendra, 

Thank you for the information. In the following ss you can see one is done by expression and other is done by label. Can you let me know whenshould I prefer label and when expression 


Hi,


As per my understanding expression is better in this case.


Thanks!


How do you decide is my question. Because we are getting work done with label as well.

Not just in this case but otherwise also.

Hi Ankita Kulkarni,


Expression is - Displays a text literal or an expression to be calculated at runtime. For example, it can be a combination of values and operators or the result of a function call.


Label And Text are- 

Provides a caption to the input fields describing the information that is being requested from the user.

Both Label and Text widgets can be used as a caption for the inputs. However, the Label widget provides better usability and accessibility because it is bound to the input. The input is activated by clicking on the text of the Label.


In your SS - if you pass static content than use Label/Text or if you pass run time value than use Expression.


Regards

Rahul Sahu


Solution

Hi Ankita,

This is explained in the online training (Reactive Web, Mobile, Traditional Web), I advise you to follow it before starting on your own projects.

  • Text widget
    display static text on a screen or block
  • Expression widget
    display dynamic content as text on a screen or block, evaluated when the widget is being rendered.
  • Label widget:
    behavior is similar to Expression (display dynamic content, evaluated when the widget is being rendered) but generates an HTML Label element instead of pure text
    • allows binding to an input that will get the focus when you click on the label
    • label has its own specific styling
    • mandatory cues will be displayed on a label if it's bound to an input with Mandatory set to Yes

This means that you should in general favor Text (for text that doesn't change) and Expressions (for dynamic content) instead of Labels, unless you want to label inputs.

Hope this clarifies things a bit more!

Solution