uri
Validates that a field contains a valid URL.
Options
| Option | Type | Default | Description |
|---|---|---|---|
message | string | locale default | Custom error message |
Playground
Valid values
| Value | Notes |
|---|---|
"https://example.com" | HTTPS URL |
"http://sub.example.co.uk/path?q=1" | With subdomain, path, and query |
"ftp://files.example.com" | FTP URL |
Invalid values
| Value | Reason |
|---|---|
"not a url" | No protocol |
"example.com" | Missing protocol |
"http://" | Missing host |
Notes
- Empty string (
"") always returnsvalid: true— validators only run on non-empty values. Combine withnotEmptyto require a value.