# Fields section

Organize form fields in your blueprints

****

- Source: <https://github.com/getkirby/kirby/tree/5.5.3/config/sections/fields.php>

****

The fields section allows you to create flexible forms in your blueprints. You can put all fields into a single fields section, or combine multiple sections to achieve more intuitive <abbr title="The Panel is Kirby's fast and powerful web interface to manage your website in the browser. The Panel is highly customizable in many ways for different project needs."><a href="https://getkirby.com/docs/glossary/#panel">Panel</a></abbr> layouts.

<figure class="image"><a data-lightbox href="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=1776&amp;height=1210&amp;enlarge=0"><img alt="" class="rounded" height="630" loading="lazy" sizes="auto" src="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=924&amp;height=630&amp;enlarge=0" srcset="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=462&amp;height=315&amp;enlarge=0 462w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=690&amp;height=470&amp;enlarge=0 690w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=924&amp;height=630&amp;enlarge=0 924w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=1380&amp;height=940&amp;enlarge=0 1380w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/630f0a7c3e-1717846665/fields-section.png?width=1776&amp;height=1210&amp;enlarge=0 1848w" width="924"></a></figure>

## Example

```yaml "/site/blueprints/pages/article.yml"
title: Article

sections:
  content:
    type: fields
    fields:
      headline:
        label: Headline
        type: text
      intro:
        label: Intro
        type: textarea
      text:
        label: Text
        type: textarea
```

<info>
While the above simple example would work without using a fields section (see <a href="https://getkirby.com/docs/guide/blueprints/layout#only-fields">blueprints guide</a>, you must use a fields section if you want to combine fields with any other type of section (files section, info section, pages section, stats section).
</info>
## Section shortcuts

For simple sections that are only used once per blueprint, you can use shortcuts. In its most basic form, a `fields` section consists of the section type as name, and a set of fields:

```yaml
sections:

  fields:
    fields:
      tags: true
      textarea: true
```
This will add a `fields` section the given fields.

Keep in mind that the same section name can only be used once per blueprint.


## Section properties

The fields section has only one option called `fields`. The `fields` option contains a list of field definitions (see example above). Check out the docs for each field type linked below to see what you can do with each field.

## Available field types

<nav class="auto-fill mb-12 text-sm" style="--min: 20rem; --gap: var(--spacing-1)">
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/blocks" style="text-decoration: none">
		<strong class="block">Blocks</strong>
		A visual editor for long-form text and modular pages	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/checkboxes" style="text-decoration: none">
		<strong class="block">Checkboxes</strong>
		A list of checkbox fields	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/color" style="text-decoration: none">
		<strong class="block">Color</strong>
		The color field supports multiple color notations, a color picker, pre-defined colors, custom color names, and transparency.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/date" style="text-decoration: none">
		<strong class="block">Date</strong>
		A date picker field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/email" style="text-decoration: none">
		<strong class="block">Email</strong>
		An email input field with validation	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/entries" style="text-decoration: none">
		<strong class="block">Entries</strong>
		The entries field allows you to create and manage multiple entries for the same field.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/files" style="text-decoration: none">
		<strong class="block">Files</strong>
		A files select field that allows you to select one or more files out of a given set. A reference to this file is stored in the content file.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/gap" style="text-decoration: none">
		<strong class="block">Gap</strong>
		Layout field to create gaps in the field grid.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/headline" style="text-decoration: none">
		<strong class="block">Headline</strong>
		Creates a headline to group fields	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/hidden" style="text-decoration: none">
		<strong class="block">Hidden</strong>
		Creates a hidden field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/info" style="text-decoration: none">
		<strong class="block">Info</strong>
		A plain HTML field for user instructions	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/layout" style="text-decoration: none">
		<strong class="block">Layout</strong>
		A visual editor for complex multi-column layouts	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/line" style="text-decoration: none">
		<strong class="block">Line</strong>
		Draws a horizontal line to separate fields	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/link" style="text-decoration: none">
		<strong class="block">Link</strong>
		Use the link field to create links to external URLs, internal pages, files, email addresses and telephone numbers. The link field is also used in the link dialogs of the writer and textarea fields.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/list" style="text-decoration: none">
		<strong class="block">List</strong>
		A simple WYSIWYG editor field for ordered and unordered lists	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/multiselect" style="text-decoration: none">
		<strong class="block">Multiselect</strong>
		A select field that allows you to select multiple options	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/number" style="text-decoration: none">
		<strong class="block">Number</strong>
		A number input field with validation	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/object" style="text-decoration: none">
		<strong class="block">Object</strong>
		Structured object input, which stores properties as YAML.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/pages" style="text-decoration: none">
		<strong class="block">Pages</strong>
		A pages select field that allows to select one or multiple related pages	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/radio" style="text-decoration: none">
		<strong class="block">Radio</strong>
		A list of radio buttons	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/range" style="text-decoration: none">
		<strong class="block">Range</strong>
		A handy slider	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/select" style="text-decoration: none">
		<strong class="block">Select</strong>
		A simple selectbox field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/slug" style="text-decoration: none">
		<strong class="block">Slug</strong>
		A slug input field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/stats" style="text-decoration: none">
		<strong class="block">Stats</strong>
		Show beautiful stats for your site or shop: revenues, orders, likes, views, etc.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/structure" style="text-decoration: none">
		<strong class="block">Structure</strong>
		Structured data input, which stores data as YAML.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/tags" style="text-decoration: none">
		<strong class="block">Tags</strong>
		An interactive tags input field with autocompletion	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/tel" style="text-decoration: none">
		<strong class="block">Tel</strong>
		A phone number input field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/text" style="text-decoration: none">
		<strong class="block">Text</strong>
		A standard, single-line input field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/textarea" style="text-decoration: none">
		<strong class="block">Textarea</strong>
		A textarea field, which auto-resizes and has built-in format buttons.	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/time" style="text-decoration: none">
		<strong class="block">Time</strong>
		A time picker field	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/toggle" style="text-decoration: none">
		<strong class="block">Toggle</strong>
		Yes/no or on/off toggle	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/toggles" style="text-decoration: none">
		<strong class="block">Toggles</strong>
		Toggle between different states	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/url" style="text-decoration: none">
		<strong class="block">Url</strong>
		A URL input field with validation	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/users" style="text-decoration: none">
		<strong class="block">Users</strong>
		A user select field that allows to select one or multiple users	</a>
		<a class="block p-3 bg-light" href="https://getkirby.com/docs/reference/panel/fields/writer" style="text-decoration: none">
		<strong class="block">Writer</strong>
		A simple WYSIWYG editor field for inline content with formats like bold, italic, etc.	</a>
	</nav>


## Multiple fields sections

Especially for more complex pages with lots of different field types, it often makes sense to layout fields in multiple columns. That way you can create a main area for the most important content and a sidebar for secondary information for example.

<figure class="image"><a data-lightbox href="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=1776&amp;height=1336&amp;enlarge=0"><img alt="" class="rounded" height="695" loading="lazy" sizes="auto" src="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=924&amp;height=695&amp;enlarge=0" srcset="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=462&amp;height=348&amp;enlarge=0 462w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=690&amp;height=519&amp;enlarge=0 690w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=924&amp;height=695&amp;enlarge=0 924w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=1380&amp;height=1038&amp;enlarge=0 1380w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/71694ce46e-1717846665/fields-in-columns.png?width=1776&amp;height=1336&amp;enlarge=0 1848w" width="924"></a></figure>

We can use the `columns` option in our blueprint to create such a layout. The number of columns is up to the actual requirements for your page type. You can get started with two columns and a classic sidebar layout, but of course it can get a lot more sophisticated than that. If you aren't yet familiar with using columns to layout your sections, check out <a href="https://getkirby.com/docs/guide/blueprints/layout">the guide</a>.

```yaml
title: Article

columns:

  # main content
  main:
    width: 2/3
    sections:
      content:
        type: fields
        fields:
          headline:
            label: Headline
            type: text
          intro:
            label: Intro
            type: textarea
            size: small
          text:
            label: Text
            type: textarea
            size: large

  # meta information
  sidebar:
    width: 1/3
    sections:
      meta:
        type: fields
        fields:
          date:
            label: Date
            type: date
          author:
            label: Author
            type: users
            multiple: false
          tags:
            label: Tags
            type: tags
```

### Tabs

When the field setup gets too complex, you can also spread forms over multiple tabs. This helps to structure your content even further and simplify the editing tasks for your editors. For example SEO information might be stored in an extra tab, because it's not updated very often, once the page is created.

Here's an example how to move the meta information for the article above into another tab.

#### Content Tab

<figure class="image"><a data-lightbox href="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=2016&amp;height=2000&amp;enlarge=0"><img alt="" class="rounded" height="917" loading="lazy" sizes="auto" src="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=924&amp;height=917&amp;enlarge=0" srcset="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=462&amp;height=458&amp;enlarge=0 462w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=690&amp;height=685&amp;enlarge=0 690w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=924&amp;height=917&amp;enlarge=0 924w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=1380&amp;height=1369&amp;enlarge=0 1380w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/6ab7c26d7c-1717846665/fields-in-tabs.png?width=1848&amp;height=1833&amp;enlarge=0 1848w" width="924"></a></figure>

#### Info Tab
<figure class="image"><a data-lightbox href="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=2016&amp;height=1600&amp;enlarge=0"><img alt="" class="rounded" height="733" loading="lazy" sizes="auto" src="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=924&amp;height=733&amp;enlarge=0" srcset="https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=462&amp;height=367&amp;enlarge=0 462w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=690&amp;height=548&amp;enlarge=0 690w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=924&amp;height=733&amp;enlarge=0 924w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=1380&amp;height=1095&amp;enlarge=0 1380w, https://assets.getkirby.com/media/pages/docs/reference/panel/sections/fields/8f88d985a6-1717846665/fields-in-tabs-2.png?width=1848&amp;height=1467&amp;enlarge=0 1848w" width="924"></a></figure>

#### Blueprint

```yaml
title: Article

tabs:

  # main content
  content:
    label: Content
    sections:
      content:
        type: fields
        fields:
          headline:
            label: Headline
            type: text
          intro:
            label: Intro
            type: textarea
            size: small
          text:
            label: Text
            type: textarea
            size: large

  # meta information
  meta:
    label: Additional information
    sections:
      meta:
        type: fields
        fields:
          date:
            label: Date
            type: date
          author:
            label: Author
            type: users
            multiple: false
          tags:
            label: Tags
            type: tags
```

## Shortcuts

Fields are such an important feature for pretty much any page type that we've created a number of shortcuts to add fields to blueprints faster.

### A page with just fields

If you need nothing more than fields for a page setup, you can use the `fields` option at the top-level of your YAML file to add all your fields without creating any sections.

```yaml
title: Article

fields:
  headline:
    label: Headline
    type: text
  intro:
    label: Intro
    type: textarea
    size: small
  text:
    label: Text
    type: textarea
    size: large
```

### Fields in columns

If you want to layout different sections you can still use the `fields` shortcut in a column to create a fields section in there.

```yaml
title: Article

columns:

  # main content
  main:
    width: 2/3
    fields:
      headline:
        label: Headline
        type: text
      intro:
        label: Intro
        type: textarea
        size: small
      text:
        label: Text
        type: textarea
        size: large

  # meta information
  sidebar:
    width: 1/3
    fields:
      date:
        label: Date
        type: date
      author:
        label: Author
        type: users
        multiple: false
      tags:
        label: Tags
        type: tags
```

### Fields in tabs

You can also create tabs with just fields and without the need to create any sections.


```yaml
title: Article

tabs:

  # main content tab
  content:
    label: Content
    fields:
      headline:
        label: Headline
        type: text
      intro:
        label: Intro
        type: textarea
        size: small
      text:
        label: Text
        type: textarea
        size: large

  # meta tab
  meta:
    label: Additional Information
    fields:
      date:
        label: Date
        type: date
      author:
        label: Author
        type: users
        multiple: false
      tags:
        label: Tags
        type: tags
```

<h2 id="conditional-sections"><a href="#conditional-sections" tabindex="-1">Conditional sections</a></h2>
<p>Like <a href="https://getkirby.com/docs/guide/blueprints/fields#conditional-fields">conditional fields</a>, sections can be shown/hidden based on the value of a given field (i.e. if a toggle is checked, a select field is at a certain option, etc.).</p>
<p>The condition for displaying the section is set with the <code class="type">when</code> option. In the <code class="type">when</code> option you define a field name as the key and the required value of that field. In the following example, the each section type is shown based on a different value of the <code class="type">postType</code> field:</p>
<figure class="code">
<pre><code class="language-yaml">sections:
  content:
    type: fields
    fields:
      postType:
        type: select
        options:
          - Gallery
          - Image
          - Text
  gallery:
    type: files
    template: gallery-image
    layout: cards
    size: tiny
    when:
      postType: Gallery
  image:
    type: files
    template: single-image
    max: 1
    layout: cards
    when:
      postType: Image
  text:
    type: fields
    fields:
      text:
        type: textarea
      tags:
        type: tags
    when:
      postType: Text</code></pre>
</figure>