Userpicker
A picker field that allows to select one or multiple users
Field options
| Name | Type | Default | Description |
|---|---|---|---|
| autofocus | bool |
false
|
Sets the focus on this field when the form loads. Only the first field with this option gets focus |
| 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 |
| empty | arrayorstring |
null
|
The placeholder text if none have been selected yet |
| help | arrayorstring |
null
|
Optional help text below the field |
| image | arrayorstringorfalse |
null
|
Image settings for each item, a query string for the preview image or false to disable previews |
| info | string |
null
|
Info text for each item |
| label | arrayorstring |
no default value | The field label can be set as string or associative array with translations |
| layout | string |
'list'
|
Switch the layout of the items. Available layouts: list, cardlets, cards and table |
| link | bool |
true
|
Whether each item should be clickable |
| max | int |
null
|
Sets the maximum number of allowed items in the field |
| min | int |
null
|
Sets the minimum number of required items in the field |
| multiple | bool |
true
|
If false, only a single one can be selected |
| picker | array |
[]
|
Additional picker dialog props { image, layout, size } |
| query | string |
null
|
Query for the items to be included in the picker |
| required | bool |
false
|
If true, the field has to be filled in correctly to be saved. |
| search | bool |
true
|
Enable/disable the search field in the picker |
| size | string |
'auto'
|
Size for layout: cards. Available sizes: auto, tiny, small, medium, large, huge, full |
| store | string |
no default value | Whether to store uuid or id in the content file of the model |
| text | string |
null
|
Main text for each item |
| 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 userpicker field can be used to select one or more users. It's perfect to store authors for an article, for example.

Example
fields:
authors:
label: Authors
type: userpicker
Default values
You can set a user email or user UUID as default value:
fields:
author:
label: Author
type: userpicker
default: johndoe@company.com # or user://H7jTLLW1
Or set the default to the current user by passing true as argument:
fields:
author:
label: Author
type: userpicker
default: true
Limit selection
Multiple or single mode
If you only want to select a single user, set multiple mode to false (default is true)
fields:
author:
label: Author
type: userpicker
multiple: false
Maximum number of users
You can set the maximum number of users that can be selected:
fields:
author:
label: Author
type: userpicker
max: 3
Query users
You can use the query property to limit the users that can be selected:
fields:
author:
label: Author
type: userpicker
query: kirby.users.filterBy("role", "editor")
Pagination
Options in the picker are paginated. You can set the number of items per pagination page in the picker using the limit property. The default setting is 20.
fields:
userpicker:
type: userpicker
label: Select an item
limit: 10
Search
The picker shows a search field by default. If you want to remove it, you can switch it off with the search option:
fields:
userpicker:
type: userpicker
label: Select an item
search: false
How to use in templates/snippets
Single user
To convert a single user to a user object, use the toUser() method:
<?php if ($user = $page->author()->toUser()): ?>
<?= $user->username() ?>
<?php endif ?>
Multiple users
To convert multiple users to a users collection, use the toUsers() method:
<?php
$users = $page->authors()->toUsers();
foreach($users as $user): ?>
<?= $user->username() ?>
<?php endforeach ?>
Update programmatically
To change the field value from PHP, pass an array of user IDs, UUIDs or email addresses to $page->update():
$page->update([
'authors' => ['user://abcd1234', 'jane@example.com']
]);
You can also pass a user object or a users collection, e.g. $kirby->users()->role('editor').
Kirby stores the users as UUIDs (or as IDs, if you set the store option to id). Users that cannot be found are skipped.
To add a user to the existing selection, pass a callback:
$page->update([
'authors' => fn ($authors) => [...$authors, 'user://abcd1234']
]);