Formify Docs

Alpha

Validate that a value contains only letters

Alpha

The alpha rule validates that a value contains only alphabetic characters (letters).

Configuration

Config flagTypeDescription
alphabooleanRequires letters only.
validationSchema: {
  name: { alpha: true },
}

With a custom message:

name: { alpha: "Only letters are allowed" }

V builder

import { V } from "formify-js";

V.alpha()
V.alpha("Only letters are allowed")

Default message

Only letters allowed

Examples

ValueResult
"hello"✅ Valid
"hello123"❌ Invalid (digits)
"hello world"❌ Invalid (space)

Things to know

  • Spaces, digits, and punctuation are rejected.
  • Empty values pass unless required: true is also set.
  • To allow digits too, use alphanumeric instead.

On this page