Skip to main content

Number

The Number component can be used in any form to provide a numeric input field. It can be configured to be readonly, disabled, required, and can have a placeholder, helper text, and default value.

Schema

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"placeholder": "Enter your age",
"description": "Age will be used for account purposes",
"readOnly": false,
"validation": {
"required": true,
"min": 10,
"max": 300
},
"htmlProps": {
"allowDynamic": true
}
}
}
]

Example

Age will be used for account purposes

Form Data:
{}

Field properties

Properties used by this field (inside meta field in schema)

NameDescriptionType
displayNameThe label shown above the number fieldstring
displayNameThe label shown above the number fieldstring
displayTypeThe type of the field to be displayedstring
placeholderThe hint shown in the number fieldstring
readOnlyA readonly field is not editable and value cannot be changedboolean
isDisabledA disabled field is not editable and value cannot be changedboolean
requiredIndicates whether the field is mandatoryboolean
patternA regex pattern that the field value must matchstring
minMinimum value for the fieldnumber
maxMaximum value for the fieldnumber
descriptionHelper text or additional description shown below the number fieldstring
valueThe default value of the fieldnumber
overrideDynamicSupportTo override the default behavior of showing static and dynamic optionsboolean

Example JSON

Placeholder

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"placeholder": "Enter your age"
}
}
]

Readonly

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"readOnly": true,
"value": 30
}
}
]

Disabled

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"isDisabled": true,
"value": 30
}
}
]

Required

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"validation": {
"required": true
}
}
}
]

Pattern

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"validation": {
"pattern": "/^\\d+$/"
}
}
}
]

Min and Max Length Validation

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"validation": {
"min": 18,
"max": 100
}
}
}
]

Helper Text

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"description": "Enter your age carefully"
}
}
]

Override dynamic support

[
{
"name": "age",
"meta": {
"displayName": "Age",
"displayType": "number",
"description": "Enter your age carefully",
"htmlProps": {
"overrideDynamicSupport": true
}
}
}
]

Field Properties - Validation Details

The validation settings within the Textarea component are crucial for ensuring that user input meets specific requirements. Here’s a breakdown of the available validation properties:

PropertyDescription
requiredBoolean value that specifies whether entering data into the field is mandatory.
minLengthSpecifies the minimum number of characters allowed in the input.
maxLengthSpecifies the maximum number of characters allowed in the input.
minSpecifies the minimum value allowed for number inputs, with support for dynamic values.
maxSpecifies the maximum value allowed for number inputs, also supporting dynamic conditions.
patternA regex pattern that the input must match to be considered valid.
validateA function for custom validation logic, which can return a boolean or an error message.

Example Usage of Validation Properties

{
"name": "comments",
"meta": {
"displayName": "Comments",
"displayType": "textarea",
"validation": {
"required": true,
"minLength": 10,
"maxLength": 300,
"min": 10,
"max": 300,
"pattern": "/^[a-zA-Z0-9 .,'-]+$/"
},
"htmlProps": {
"minRows": 3,
"maxRows": 6,
"overrideDynamicSupport": true
}
}
}