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.
Constructor for a new Label.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.ui.commons.Label(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
design | sap.ui.commons.LabelDesign | Standard | Defines whether the labels are in bold format. Visibility: public |
icon | sap.ui.core.URI | Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI. Visibility: public |
|
required | boolean | false | 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. |
requiredAtBegin | boolean | Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set). |
|
text | string | empty string | Determines the text to be displayed. Visibility: public |
textAlign | sap.ui.core.TextAlign | Begin | Determines the alignment of the text. Available options are |
textDirection | sap.ui.core.TextDirection | Inherit | Determines the text direction - right-to-left (RTL) and left-to-right (LTR). Visibility: public |
width | sap.ui.core.CSSSize | empty string | Determines the control width as common CSS-size (for example, px or % as unit). Visibility: public |
wrapping | boolean | false | Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is. Visibility: public |
Name | Cardinality | Type | Description |
---|---|---|---|
labelFor | 0..1 | sap.ui.core.Control |
Defines the association to the labeled control. By default, the label is set the for the attribute to the ID of the labeled control. This can be changed with the implementation of function getIdForLabel on the labelled control. |
Method | Description |
---|---|
sap.ui.commons.Label.extend |
Creates a new subclass of class sap.ui.commons.Label with name
|
getAccessibilityInfo |
References:
|
getDesign |
Gets current value of property design. Defines whether the labels are in bold format. Default value is |
getIcon |
Gets current value of property icon. Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI. |
getLabelFor |
ID of the element which is the current target of the association labelFor, or |
sap.ui.commons.Label.getMetadata |
Returns a metadata object for class sap.ui.commons.Label. |
getRequired |
Gets current value of property 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 |
getRequiredAtBegin |
Gets current value of property requiredAtBegin. Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set). |
getText |
Gets current value of property text. Determines the text to be displayed. Default value is |
getTextAlign |
Gets current value of property textAlign. Determines the alignment of the text. Available options are Default value is |
getTextDirection |
Gets current value of property textDirection. Determines the text direction - right-to-left (RTL) and left-to-right (LTR). Default value is |
getWidth |
Gets current value of property width. Determines the control width as common CSS-size (for example, px or % as unit). Default value is |
getWrapping |
Gets current value of property wrapping. Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is. Default value is |
setDesign |
Sets a new value for property design. Defines whether the labels are in bold format. When called with a value of Default value is |
setIcon |
Sets a new value for property icon. Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI. When called with a value of |
setLabelFor |
Sets the associated labelFor. |
setRequired |
Sets a new value for property 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 Default value is |
setRequiredAtBegin |
Sets a new value for property 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 |
setText |
Sets a new value for property text. Determines the text to be displayed. When called with a value of Default value is |
setTextAlign |
Sets a new value for property textAlign. Determines the alignment of the text. Available options are When called with a value of Default value is |
setTextDirection |
Sets a new value for property textDirection. Determines the text direction - right-to-left (RTL) and left-to-right (LTR). When called with a value of Default value is |
setWidth |
Sets a new value for property width. Determines the control width as common CSS-size (for example, px or % as unit). When called with a value of Default value is |
setWrapping |
Sets a new value for property 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 Default value is |
Creates a new subclass of class sap.ui.commons.Label with name 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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Gets current value of property design.
Defines whether the labels are in bold format.
Default value is Standard
.
Gets current value of property icon.
Determines the icon to be displayed in the control. This can be a URI to an image or an icon font URI.
Gets current value of property 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
.
Gets current value of property requiredAtBegin.
Determines whether the required indicator is at the beginning of the label (if set) or at the end (if not set).
Gets current value of property text.
Determines the text to be displayed.
Default value is empty string
.
Gets current value of property textAlign.
Determines the alignment of the text. Available options are Begin
, Center
, End
, Left
, and Right
.
Default value is Begin
.
Gets current value of property textDirection.
Determines the text direction - right-to-left (RTL) and left-to-right (LTR).
Default value is Inherit
.
Gets current value of property width.
Determines the control width as common CSS-size (for example, px or % as unit).
Default value is empty string
.
Gets current value of property wrapping.
Specifies whether a line wrapping width shall be displayed when the text value is longer than the width is.
Default value is false
.
Sets a new value for property 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sDesign | sap.ui.commons.LabelDesign | Standard |
New value for property |
Sets a new value for property icon.
Determines the icon to be displayed in the control. This can be a 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.
Param | Type | DefaultValue | Description |
---|---|---|---|
sIcon | sap.ui.core.URI |
New value for property |
Sets the associated labelFor.
Param | Type | DefaultValue | Description |
---|---|---|---|
oLabelFor | sap.ui.core.ID sap.ui.core.Control |
ID of an element which becomes the new target of this labelFor association; alternatively, an element instance may be given |
Sets a new value for property 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bRequired | boolean | false |
New value for property |
Sets a new value for property 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.
Param | Type | DefaultValue | Description |
---|---|---|---|
bRequiredAtBegin | boolean |
New value for property |
Sets a new value for property 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 empty string
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sText | string | '' |
New value for property |
Sets a new value for property 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextAlign | sap.ui.core.TextAlign | Begin |
New value for property |
Sets a new value for property 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextDirection | sap.ui.core.TextDirection | Inherit |
New value for property |
Sets a new value for property 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 empty string
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize | '' |
New value for property |
Sets a new value for property 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
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bWrapping | boolean | false |
New value for property |