Domain Validate domain names without the protocol or path.
Validates that a value is a domain name — labels separated by dots, with a valid top-level domain. The protocol (https://), port, and path are not part of the accepted format.
Config flag Type Description domainbooleanWhen true, requires the value to be a valid domain name.
const form = useForm ({
initialValues: { site: '' },
validationSchema: {
site: { domain: true },
},
});
import { V } from 'formify-js' ;
V . domain ();
Scenario Message Value is not a domain Must be a valid domain name
Value Result 'example.com'✅ Valid 'sub.domain.co.uk'✅ Valid 'https://example.com'❌ Invalid (protocol not allowed) 'example'❌ Invalid (no TLD)
For full URLs (with protocol, port, query), use the url validator instead.
Both the domain and url validators can be combined when a field should accept either form — see the V.any composition.