promise
Validates a field using a custom asynchronous function.
Options
| Option | Type | Default | Description |
|---|---|---|---|
promise | (input: ValidatorInput) => Promise<{ valid: boolean, message?: string }> | required | Custom async validation function |
message | string | locale default | Custom error message |
Playground
Valid values
| Value | Notes |
|---|---|
Promise resolves { valid: true } | Validation passes |
Invalid values
| Value | Reason |
|---|---|
Promise resolves { valid: false } | Validation fails with default or inline message |
Notes
- Empty string (
"") always returnsvalid: true— validators only run on non-empty values. Combine withnotEmptyto require a value. - Same
inputobject ascallback:value,elements,options,field. - For synchronous checks, use
callbackinstead. - Rejection (thrown error) is treated as invalid.