Skip to main content
Validators help ensure that user input meets certain criteria or constraints. Below are some examples of validator functions:

Validators

Pattern

Checks if the processed value matches a specific regular expression.

Max Length

Verifies if the processed string length is within a specified maximum limit.

Min Length

Verifies if the processed string length is within a specified minimum limit.

Min Value

Ensures that the processed numeric value is greater than or equal to a specified minimum.

Max Value

Ensures that the processed numeric value is less than or equal to a specified maximum.

In Range

Checks if the processed numeric value falls within a specified range.

One Of

Validates whether the processed value is one of the specified values.

Number

Validates whether the processed value is a valid number.

Non Zero

Validates whether the processed value is strictly NOT zero. Designed to be used with Validators.number

Image

Verifies whether the processed value is a valid image file based on its extension.

File

Ensures that the processed value is a valid file.

Email

Validates whether the processed value is a valid email address.

URL

Ensures that the processed value is a valid URL.

Datetime ISO

Validates whether the processed value is a valid ISO-formatted date and time.

Custom

Example: Note: The custom validator allows you to define your own validation logic and error message. It can be used to perform complex validations beyond the provided built-in validators.

Processors

Processors act as data transformers, enabling you to transform or process user input before further processing. To add a custom processor, you can define a function with this type ProcessorFn that takes two parameters: The function should return the processed value. Here’s an example: