Alpha
Validate that a value contains only letters
Alpha
The alpha rule validates that a value contains only alphabetic characters (letters).
Configuration
| Config flag | Type | Description |
|---|---|---|
alpha | boolean | Requires 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
| Value | Result |
|---|---|
"hello" | ✅ Valid |
"hello123" | ❌ Invalid (digits) |
"hello world" | ❌ Invalid (space) |
Things to know
- Spaces, digits, and punctuation are rejected.
- Empty values pass unless
required: trueis also set. - To allow digits too, use
alphanumericinstead.