Intro

A label is the name or title of a control or group of related controls.

Label

Label "Name" in a form

Usage

Use the label control if:

Do not use the label control if:

Types

There are two types of labels:

  • Required
  • Optional

To indicate that a field is required, set the required property to true. An asterisk is then added automatically in front of the label.

Required label in an editable environment (horizontal layout)

Required label in an editable environment (horizontal layout)

Result of a required label in a display-only environment

Result of a required label in a display-only environment

Optional label in an editable environment (vertical layout)

Optional label in an editable environment (vertical layout)

Result of an optional label in a display-only environment

Result of an optional label in a display-only environment

Styles

For better differentiation of labels and values, labels are displayed differently in a display-only environment than in an editable environment.

Wrapping

Automatic wrap only applies to labels within forms to avoid truncation.

Do not use wrapping to enable long labels. Instead, keep your labels short: a label is not a help text. It must be meaningful, succinct, short, and descriptive. For more information about the responsive behavior of text, see Wrapping and Truncating Text.

hint

The boolean wrapping property for the sap.m.Label control determines whether or not the text wraps .

Note: Only use this property in forms.

Hyphenation

The label control also supports hyphenation for wrapped texts (property: wrappingtype = Hyphenated). Switching on hyphenation activates it for all languages that have hyphenation support.

changes

[internal_only]

In the future, we plan to apply hyphenation only to a predefined set of languages (for example, languages that have a lot of long or compound words).

This will avoid unnecessary hyphenation in languages that have shorter words, such as English.

[/internal_only]

Wrapping label

Wrapping label

Guidelines

Exceptions

The layout can sometimes be simplified by using a placeholder instead of the label control. This exception can be applied in the following cases:

Resources

Want to dive deeper? Follow the links below to find out more about related controls, the SAPUI5 implementation, and the visual design.

Elements and Controls

Implementation

Visual Design

Label