Built-in Validators
Every Formify validator explained — config flags, the V builder, and messages
Built-in Validators
Formify ships 35+ validators. Each has a dedicated page below covering every supported way to use it.
Two ways to use a validator
Every validator can be used in two interchangeable styles:
1. Config flag in a validationSchema
validationSchema: {
email: { required: true, email: true },
}A true value enables the rule. Passing a string overrides its message:
email: { email: "Enter a valid email" }Parameterized rules use a value instead of true — minLength: 8, or a tuple to override the message: minLength: [8, "Too short"].
2. Composable rule from the V builder
V produces reusable Rule objects for the v1-style validators array and advanced composition:
import { V } from "formify-js";
const schema = {
email: {
required: true,
validators: [
{ validator: V.email(), message: "Enter a valid email" },
],
},
};Empty-value semantics
Only required fails on empty input. Every other rule validates the value when present, so optional fields work without extra ceremony — combine a rule with required: true when the field must be filled.
What counts as empty:
"",null,undefined, and empty arrays.
Validator pages
Presence & format
- required — value must not be empty
- email — email address
- url — http/https/ftp URL
- phone — international phone number
- uuid — UUID v1–v5
- ip — IPv4 or IPv6 (
ip,ipv4,ipv6)
Character classes
- alpha — letters only
- alphanumeric — letters + digits
- numeric — number or numeric string
- integer — integer
- decimal — decimal number
- strong-password — strong password policy
- uppercase / lowercase — case-only strings
- no-whitespace — no whitespace
- special-characters — at least one special character
- trimmed — no leading/trailing spaces
- contains-uppercase, contains-lowercase, contains-number, contains-special — granular character checks
Dates, times & identifiers
- date — valid date
- time —
HH:mm(:ss) - zip — US ZIP code
- ssn — Social Security Number
- ein — Employer ID
- hex-color —
#fff/#ffffff - mac-address — MAC address
- isbn — ISBN-10 / ISBN-13
- domain — domain name
- username — 3–20 chars: letters, digits,
_. - slug — lowercase letters, digits, hyphens
- base64 — base64 string
- hex — hexadecimal string
- latitude / longitude — geographic coordinates
Length & ranges
- min-length / max-length — string length
- min / max — numeric bounds
- between — numeric range
- pattern — custom regex
- array-length — array length range
- file-extension — allowed file extensions
Choice & relations
- one-of / not-one-of — membership
- confirm — match another field
- starts-with / ends-with / includes — string relations
Beyond individual rules
- composition —
V.all,V.any,V.not,V.optional - messages — how error messages are resolved (i18n)
- regexval — v1 compatibility helpers