Contact us

Applies to: Customer's Canvas On-Premises; Customer's Canvas Hub cloud; UI Framework 4.0 - 4.47

Skip to main content

Input text

A text input field widget.

Input-text widget.

General info​

  • type: input-text

Params​

  • placeholder: a string that is displayed as a hint. By default, this is an empty string.
  • label: a string that is used as a label of the widget. By default, this is an empty string.
  • supportText: an optional string. By default, this is an empty string.
  • defaultValue: the default value of the widget, either a string or number. By default, this is an empty string.
  • type: the widget type, either "number" or "text". The default value is "text".
  • maxLength: the max text length. For numbers, maxLength defines the number of digits and only works with positive values.
  • min and max: the allowed range of values of the number type. The default values are -999999 and 999999.
  • isTextArea: if true, enables a text area instead of single-line text. The default value is false.
  • rows: the widget height in rows if the text area mode is on. The default value is 2.
  • pattern: a regular expression to limit input. The default value is ".+".

Events​

  • onChange: a function ("{{#function <expression>}}") or an array of functions. This event triggers when the user changes the text in the widget.

Referring to a value in the config​

You may refer to a value of a widget by using the value or _ shortcut:

{
"text": "{{$['main-text']._}}"
}

Example​

{
"name": "main-text",
"type": "input-text",
"params": {
"isTextArea": true,
"defaultValue": "Hello world",
"prompt": "Enter your text",
"maxLength": 20
}
}
Was this page helpful?