No Whitespace Reject values that contain any whitespace characters.
Validates that a value contains no whitespace at all — not just leading/trailing whitespace, but also spaces, tabs, and line breaks anywhere in the string.
Config flag Type Description noWhitespacebooleanWhen true, rejects any whitespace character in the value.
const form = useForm ({
initialValues: { apiKey: '' },
validationSchema: {
apiKey: { noWhitespace: true },
},
});
import { V } from 'formify-js' ;
V . noWhitespace ();
Scenario Message Any whitespace found Must not contain whitespace
Value Result 'abc123'✅ Valid 'abc 123'❌ Invalid (internal space) ' abc'❌ Invalid (leading space) 'abc\t'❌ Invalid (tab)
Stricter than the trim option: trim only removes edges, while noWhitespace forbids whitespace everywhere.
Ideal for API keys, tokens, usernames, and other machine-generated identifiers.