# Validation rules

You can set validation rules for components through the validate configuration item.Custom form components also support validation.

Online example

type needs to be defined according to the value type of the component

# Verify input component is required

# Verify that the InputNumber component is at least 10

# Verify date component is required

# Validate at least 3 checkbox components

# Validation Rule Description

Parameter Description Type Default
enum enumeration type string -
len Field Length number -
max maximum length number -
message check copy string -
min minimum length number -
pattern Regular Expression Checking RegExp -
required required boolean false
transform transform field value before validation function (value) => transformedValue: any -
type Built-in validation type, optional string 'string'
validator custom validation function (rule, value, callback) -
whitespace If required, whether whitespace will be treated as an error boolean false

More advanced usage can be studied in async-validator.