Formify Docs

Phone

Validate international phone numbers

Phone

The phone rule checks that a value is a well-formed international phone number.

What it checks

A string of 7–20 characters made of digits, spaces, parentheses, dots, or dashes, with an optional leading +:

/^[+]?[0-9\s().-]{7,20}$/

Config flag

validationSchema: {
  phone: { phone: true },
}

With a custom message:

phone: { phone: "Enter a valid phone number" }

V builder

import { V } from "formify-js";

V.phone()                    // default message
V.phone("Enter a valid phone number")

Default message

Please enter a valid phone number

Things to know

  • Empty values pass unless required: true is also set.
  • This validates format, not the actual number — pair it with the phone formatter (format: { type: "phone" }) for a country-aware mask as the user types.

On this page