Class sap.ui.commons.LabelModule: sap/ui/commons/Label
The control is used for labeling other controls. The API provides formatting options, for example, for bold display or alignment. A label can have an icon.
Deprecated API:Since version 1.38. Instead, use the sap.m.Label
control.
sClassName
and enriches it with the information contained in oClassInfo
. Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.
The supported settings are:
- Properties
- design : sap.ui.commons.LabelDesign (default: Standard)
- textDirection : sap.ui.core.TextDirection (default: Inherit)
- wrapping : boolean (default: false)
- width : sap.ui.core.CSSSize (default: )
- text : string (default: )
- icon : sap.ui.core.URI
- textAlign : sap.ui.core.TextAlign (default: Begin)
- required : boolean (default: false)
- requiredAtBegin : boolean
In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.
{string} | sId? | ID for the new control, generated automatically if no ID is given |
{object} | mSettings? | Initial settings for the new control |
- Deprecated:
- Since version 1.38. Instead, use the
sap.m.Label
control.
sClassName
and enriches it with the information contained in oClassInfo
. oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
{string} | sClassName | Name of the class being created |
{object} | oClassInfo? | Object literal with information about the class |
{function} | FNMetaImpl? | Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata |
{function} | Created class / constructor function |
{sap.ui.base.Metadata} | Metadata object describing this class |
design
. Defines whether the labels are in bold format.
Default value is Standard
.
{sap.ui.commons.LabelDesign} | Value of property design |
icon
. Determines the icon to be displayed in the control. This can be an URI to an image or an icon font URI.
{sap.ui.core.URI} | Value of property icon |
labelFor
, or null
. {sap.ui.core.Control} |
required
. Allows to enforce the required indicator even when the associated control doesn't have a getRequired method (a required property) or when the flag is not set. If the associated control has a required property, the values of both required flags are combined with the OR operator, so a Label can't override a required=true value.
Default value is false
.
- Since:
- 1.11.0
{boolean} | Value of property required |
requiredAtBegin
. Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set).
- Since:
- 1.14.0
{boolean} | Value of property requiredAtBegin |
text
. Determines the text to be displayed.
Default value is .
{string} | Value of property text |
textAlign
. Determines the alignment of the text. Available options are Begin
, Center
, End
, Left
, and Right
.
Default value is Begin
.
{sap.ui.core.TextAlign} | Value of property textAlign |
textDirection
. Determines the text direction - right-to-left (RTL) and left-to-right (LTR).
Default value is Inherit
.
{sap.ui.core.TextDirection} | Value of property textDirection |
width
. Determines the control width as common CSS-size (for example, px or % as unit).
Default value is .
{sap.ui.core.CSSSize} | Value of property width |
wrapping
. Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is.
Default value is false
.
{boolean} | Value of property wrapping |
{Boolean} | Returns if the Label or the labelled control are required |
design
. Defines whether the labels are in bold format.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Standard
.
{sap.ui.commons.LabelDesign} | sDesign | New value for property design |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
icon
. Determines the icon to be displayed in the control. This can be an URI to an image or an icon font URI.
When called with a value of null
or undefined
, the default value of the property will be restored.
{sap.ui.core.URI} | sIcon | New value for property icon |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
labelFor
. {sap.ui.core.Control} | oLabelFor | Id of an element which becomes the new target of this labelFor association; alternatively, an element instance may be given |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
required
. Allows to enforce the required indicator even when the associated control doesn't have a getRequired method (a required property) or when the flag is not set. If the associated control has a required property, the values of both required flags are combined with the OR operator, so a Label can't override a required=true value.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bRequired | New value for property required |
- Since:
- 1.11.0
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
requiredAtBegin
. Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set).
When called with a value of null
or undefined
, the default value of the property will be restored.
{boolean} | bRequiredAtBegin | New value for property requiredAtBegin |
- Since:
- 1.14.0
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
text
. Determines the text to be displayed.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{string} | sText | New value for property text |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
textAlign
. Determines the alignment of the text. Available options are Begin
, Center
, End
, Left
, and Right
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Begin
.
{sap.ui.core.TextAlign} | sTextAlign | New value for property textAlign |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
textDirection
. Determines the text direction - right-to-left (RTL) and left-to-right (LTR).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Inherit
.
{sap.ui.core.TextDirection} | sTextDirection | New value for property textDirection |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
width
. Determines the control width as common CSS-size (for example, px or % as unit).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is .
{sap.ui.core.CSSSize} | sWidth | New value for property width |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |
wrapping
. Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
{boolean} | bWrapping | New value for property wrapping |
{sap.ui.commons.Label} | Reference to this in order to allow method chaining |