<ui5-labelstyle="width:200px">Long labels are truncated by default.</ui5-label>
Wrapped Label
Long labels can wrap if the 'wrapping-type="Normal"' property is set.
<ui5-labelstyle="width:200px"wrapping-type="Normal">Long labels can wrap if the 'wrapping-type="Normal"' property is set.</ui5-label>
Label 'for'
First name Date of birth JobManagerSalesDeveloper Description label test
Accept terms of use
<ui5-labelid="myLabel"for="myInput"requiredshow-colon>First name</ui5-label><ui5-inputid="myInput"requiredplaceholder="Enter your name"></ui5-input><ui5-labelid="myLabel2"for="myDP"requiredshow-colon>Date of birth</ui5-label><ui5-date-pickerid="myDP"required></ui5-date-picker><ui5-labelid="myLabel3"for="mySelect"requiredshow-colon>Job</ui5-label><ui5-selectid="mySelect"required><ui5-option>Manager</ui5-option><ui5-option>Sales</ui5-option><ui5-optionselected>Developer</ui5-option></ui5-select><ui5-labelid="myLabel4"for="myTextArea"requiredshow-colon>Description label test</ui5-label><ui5-textareaid="myTextArea"requiredplaceholder="Type as much text as you wish"></ui5-textarea><ui5-labelfor="myCB"requiredshow-colon>Accept terms of use</ui5-label><ui5-checkboxid="myCB"required></ui5-checkbox>
Overview
The ui5-label is a component used to represent a label, providing valuable information to the user. Usually it is placed next to a value holder, such as a text field. It informs the user about what data is displayed or expected in the value holder.
The ui5-label appearance can be influenced by properties, such as required and wrappingType. The appearance of the Label can be configured in a limited way by using the design property. For a broader choice of designs, you can use custom styles.
ES6 Module Import
import "@ui5/webcomponents/dist/Label";
Properties/Attributes
You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.
Name
Type
Default Value
Description
for
string
""
Defines the labeled input by providing its ID.
Note: Can be used with both ui5-input and native input.
required
boolean
false
Defines whether an asterisk character is added to the component text.
Note: Usually indicates that user input (bound with the for property) is required. In that case the required> property of the corresponding input should also be set.
showColon
show-colon
boolean
false
Defines whether colon is added to the component text.
Note: Usually used in forms.
wrappingType
wrapping-type
WrappingType
"None"
Defines how the text of a component will be displayed when there is not enough space. Available options are:
None - The text will be truncated with an ellipsis.
Normal - The text will wrap. The words will not be broken based on hyphenation.
Slots
This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.
Slot
Type
Description
default
Node [0..n]
Defines the text of the component. Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
Theme:Morning Horizon (Light)Evening Horizon (Dark)Horizon High Contrast BlackHorizon High Contrast WhiteQuartz LightQuartz DarkQuartz High Contrast BlackQuartz High Contrast White