Formify Docs
Validators

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

Dates, times & identifiers

Length & ranges

Choice & relations

Beyond individual rules

  • composition — V.all, V.any, V.not, V.optional
  • messages — how error messages are resolved (i18n)
  • regexval — v1 compatibility helpers

On this page