Normalize
The built-in normalize plugin — clean values while typing
Normalize
The normalize field config is powered by the built-in normalizePlugin. It transforms a value as the user types, before validation — so errors always match what the user sees.
Presets
| Preset | Effect |
|---|---|
"trim" | Strip leading/trailing whitespace |
"uppercase" | Convert to uppercase |
"lowercase" | Convert to lowercase |
"digits" | Keep digits only |
"alphanumeric" | Keep letters and digits only |
Usage
validationSchema: {
username: { required: true, normalize: "trim" },
code: { normalize: "uppercase" },
phone: { normalize: (v) => String(v).replace(/[^\d+]/g, "") },
}Any function (value) => value works as a custom normalizer.
Overriding the built-in
Pass a plugin named normalize to replace it — for example, to disable normalization globally:
plugins: [{ name: "normalize", onChange: () => undefined }]Things to know
- Normalization runs on change only — for blur-timed cleanup, use the
formatconfig withtrigger: "onBlur"instead. - For masked formatting (SSN, phone, currency), use the format plugin.