Skip to main content

Label

What is the Form Label?

The Form Label is not an input type, but a display tool. With the label you can show text to the user.

label.png

Options

Alignment

  • Specifies where the text appears within the label.
  • Possible values: Top-Left, Top-Center, Top-Right, Center-Left, Center-Center, Center-Right, Bottom-Left, Bottom-Center, Bottom-Right.
  • Default: Center-Center.

Capitalize

  • When enabled, the first character of the text is capitalized (only the first character, not every word).
  • Capitalization is applied after the text is truncated to the maximum character count.
  • Default: false.

Maximum characters

  • The maximum number of characters shown. When the text is longer, it is truncated to this length and an ellipsis (...) is appended.
  • Range: 3 to 30, step 1.
  • Default: 10.

Text

  • The text that appears on the label.

Setting Mock Field and Own Value

The Label sets the Mock field and the Own value at the same time, to the same value. This value is the visible text shown on the label (after truncation, capitalization, and localisation). This happens when:

  • The widget is rendered.
  • The label text changes.

Each write also stores the alignment, capitalize, and maximum (maximum characters) properties. When the visible text is empty, no write occurs, so the Mock and Own values keep their previous value.

Note

The visible text is passed through localisation. If a translation exists for the current language, the translated text is shown and stored, and the label re-renders when the language changes.

Validation

The Label does not validate.

Sensor Events

Whenever the label is written, the field broadcasts a sensor event named after the field, carrying the visible text:

{FORM-NAME} value: [visible text]

{FORM-NAME} is the name given to the label. The Label does not validate, so it does not send a {FORM-NAME}-valid event.

External Messages

The Label listens to the three basic external messages:

  • Set Form: Reads the value parameter and sets it as the label text. If no valid value is supplied, the label falls back to the configured Text.
  • Clear Form: Clears the visible text to an empty string. (Because empty text is not written, the Mock and Own values keep their previous value.)
  • Reset Form: Restores the label to the configured Text.

Value from Datasource

  • The Label does not build its content from an external (bound) datasource array.
  • On mount, if the bound form output datasource already holds a value for this field, the label is initialized to that stored value (then truncated, capitalized, and localised) instead of the configured Text.