Skip to main content

Textarea properties

Usage

{
type: "textarea",
name?: string,
id?: string,
value?: string,
numberMask?:
| {
prefix?: string; // "" by default (before the value)
suffix?: string; // "" by default (after the value)
groupSeparator?: string; // "," by default
decSeparator?: string; // "." by default
allowNegative?: boolean; // true by default
maxIntLength?: number; // 16 by default (for the number type)
maxDecLength?: number; // 2 by default (for the number type)
minDecLength?: number; // 0 by default
}
| boolean,
patternMask?:
| {
pattern: ((value: string | number) => string) | string;
charFormat?: {
[char: string]: RegExp;
};
}
| string,

css?: string,
disabled?: boolean, // false by default
height?: string | number | "content", // "content" by default
hidden?: boolean, // false by default
padding?: string | number,
required?: boolean, // false by default
validation?: string | (input: string | number) => boolean,
width?: string | number | "content", // "content" by default

maxlength?: number | string,
minlength?: number | string,
placeholder?: string,
readOnly?: boolean, // false by default
resizable?: boolean, // false by default

hiddenLabel?: boolean, // false by default
label?: string,
labelPosition?: "left" | "top", // "top" by default
labelWidth?: string | number,

helpMessage?: string,
preMessage?: string,
successMessage?: string,
errorMessage?: string,
}

Description

type(required) the type of a control, set it to "textarea"
name(optional) the name of a control
id(optional) the id of a control, auto-generated if not set
value(optional) the initial value of the textarea
numberMask(optional) sets an input mask for entering number values. Can be set in two ways:
  • as an object with the following properties:
      - prefix - renders a text before the resulting value
      - suffix - renders a text after the resulting value
      - groupSeparator - sets a separator for thousands
      - decSeparator - sets a separator for decimals
      - allowNegative - allows using negative numbers
      - maxIntLength - allows setting the maximal length of an integer
      - maxDecLength - allows setting the maximal length of a decimal
      - minDecLength - allows setting the minimal rendered length of a decimal
  • as a boolean value converts the number value displayed in the input field into one of the predefined templates (uses the default numberMask config object depending on the specified input type)
patternMask(optional) sets an input mask for entering number and string values according to a special pattern. Can be set in two ways:
  • as an object with the following properties:
      - pattern - (function | string) allows specifying the necessary mask and change it dynamically, depending on the entered values. Can be set as:
      • a function that takes as a parameter an entered value specified as a string or as a number and returns a string with a pattern mask
      • a string with a pattern mask
      - charFormat - (object) allows specifying a regular expression for an optional symbol. It is set as an object with key:value pairs, where the key is a symbol and the value is a regular expression
  • as a string allows setting a mask as a string using a predefined set of symbols
css(optional) adds style classes to a control
disabled(optional) defines whether a control is enabled (false) or disabled (true), false by default
height(optional) the height of a control, "content" by default
hidden(optional) defines whether a control is hidden, false by default
padding(optional) sets padding between a cell and a border of the Textarea control
required(optional) defines whether a control is required, false by default
validation(optional) the rule of input validation. Can be set in two ways:
  • as a predefined string value:
      - "email" - validEmail
      - "integer" - validInteger
      - "numeric" - validNumeric
      - "alphanumeric" - validAplhaNumeric
      - "IPv4" - validIPv4
  • as a function that defines a custom validation rule. It takes as a parameter the value typed in the input and returns true, if the entered value is valid.
width(optional) the width of a control, "content" by default
maxlength(optional) the maximum number of characters allowed in the textarea
minlength(optional) the minimum number of characters allowed in the textarea
placeholder(optional) a tip for the textarea
readOnly(optional) defines whether a textarea is readonly, false by default
resizable(optional) adds a resizer icon into a textarea, if set to true, false by default
hiddenLabel(optional) makes the label invisible, false by default
label(optional) specifies a label for a control
labelPosition(optional) defines the position of a label: "left" | "top", "top" by default
labelWidth(optional) sets the width of the label of a control
helpMessage(optional) adds a help message to a control
preMessage(optional) a message that contains instructions for interacting with the control
successMessage(optional) a message that appears in case of successful validation of the control value
errorMessage(optional) a message that appears in case of error during validation of the control value

Example

Related article: Textarea