Url
A URL input field with validation
Field options
| Name | Type | Default | Description |
|---|---|---|---|
| after | arrayorstring |
null
|
Optional text that will be shown after the input |
| autocomplete | string |
'url'
|
Sets the HTML5 autocomplete mode for the input |
| autofocus | bool |
false
|
Sets the focus on this field when the form loads. Only the first field with this option gets focus |
| before | arrayorstring |
null
|
Optional text that will be shown before the input |
| converter | string |
null
|
The field value will be converted with the selected converter before the value gets saved. Available converters: label, lower, slug, ucfirst, upper |
| counter | bool |
false
|
Shows or hides the character counter in the top right corner |
| default | mixed |
null
|
Default value for the field, which will be used when a page/file/user is created |
| disabled | bool |
false
|
If true, the field is no longer editable |
| font | string |
'sans-serif'
|
Sets the font family (sans or monospace) |
| help | arrayorstring |
null
|
Optional help text below the field |
| icon | string |
'url'
|
Optional icon that will be shown at the end of the field |
| label | arrayorstring |
no default value | The field label can be set as string or associative array with translations |
| maxlength | int |
null
|
Maximum number of allowed characters |
| minlength | int |
null
|
Minimum number of required characters |
| pattern | string |
null
|
A regular expression, which will be used to validate the input |
| placeholder | arrayorstring |
'https://example.com'
|
Optional placeholder value that will be shown when the field is empty |
| preselect | bool |
false
|
Focuses the input and selects its value when the form loads |
| required | bool |
false
|
If true, the field has to be filled in correctly to be saved. |
| spellcheck | bool |
null
|
If false, spellcheck will be switched off |
| translate | bool |
true
|
Should the field be translatable? |
| validate | arrayorstring |
null
|
Additional validator rules for the value, e.g. email or ['minLength' => 3] |
| when | array |
null
|
Conditions when the field will be shown |
| width | string |
'1/1'
|
The width of the field in the field grid. Available widths: 1/1, 1/2, 1/3, 1/4, 2/3, 3/4 |
The url field is a standard text field with the type url and a custom URL icon. It comes with built-in validation for URLs.

The URL validation may lead to incorrect results (= a valid URL being marked as invalid or the other way around) in rare edge-cases. In those edge-cases you can manually input the URL into the content text files or switch to a simple text field.
Example
fields:
url:
label: URL
type: url
How to use in templates/snippets
Output the field value as simple string:
<?= $page->url() ?>
Convert to a tag:
<?= $page->url()->toLink() ?>
See the docs for the toLink() method for further options.
For more field manipulations, check out Kirby's field methods.
Update programmatically
To change the field value from PHP, pass a string to $page->update():
$page->update([
'url' => 'https://getkirby.com'
]);
By default, the value is not validated when you update it programmatically. Make sure it is a valid URL.