Skip to content

Fields

No matter if you use presets or create your own layouts, form fields are an essential part of the configuration and have very powerful options.

Naming fields

You can choose the names for your fields freely, but there are two limitations:

  1. You can only use alphanumeric characters and underscores in field names.
  2. Do not use names that are reserved by native page methods. For example, if you give your field the name "image", it will conflict with Kirby's $page->image() method.

Available form fields

Custom fields

You can extend this list with your own field types by creating a field plugin.

Conditional fields

Since 3.1.0

In all fields, you can set a condition for displaying the field via the when option. In the when option you define a field name as the key and the required value of that field. In the following example, the text field is only shown when the toggle is set to true:

fields:
  toggle:
    type: toggle
  text:
    type: text
    when:
      toggle: true

If multiple conditions should be fulfilled to show a field, you can add more of them to the when option. All of these conditions need to be fulfilled to display the field:

fields:
  toggle:
    type: toggle
  category:
    type: select
    options:
      - A
      - B
      - C
  text:
    type: text
    when:
      toggle: true
      category: B