Skip to content

Input types & multiple selection ​

The Input type setting controls how the options are shown. The saved value is the same for every input type. Only Save as and Allow multiple change what is stored.

Input typeinput_typeSingleMultiple
Select dropdown (default)selectDropdownMulti-select with chips
Radio buttons / CheckboxesradioRadio buttonsCheckboxes
Button groupbutton_groupOne active buttonSeveral active buttons
Image gridimage_gridClick a tileClick several tiles

The same Sizes list shown as a select dropdown, radio buttons, inline radio buttons and a button groupThe same Sizes list shown as a select dropdown, radio buttons, inline radio buttons and a button group

The same List source with four input types.

Select dropdown ​

The default. It becomes searchable once there are more than 8 options. When the source is an Assets field, or an Option image source is set, the options and the selected value show a small thumbnail.

Dropdown of gallery images with a thumbnail next to each file nameDropdown of gallery images with a thumbnail next to each file name

Dropdown with thumbnails from an Assets source.

Radio buttons / Checkboxes ​

Radio buttons for single selection. With Allow multiple they become checkboxes. Turn on Inline (inline: true) to put them next to each other. A single selection can be removed with the Clear button.

Button group ​

A segmented button group, for short lists such as sizes or brand colours. With Allow multiple several buttons can be active at once.

Image grid ​

Statamic 6.44+

The image grid reuses Statamic's own image grid component, added in Statamic 6.44. On older versions this input type is hidden in the field settings, and a field that is already set to it shows the select dropdown (with thumbnails) instead.

The same UI as Statamic's Image Choice fieldtype. It needs images: either an Assets source field, or object items with an Option image source. Without either, the tiles show a placeholder and the field shows a warning.

OptionYAMLDefault
Columnscolumns4Images per row.
Aspect ratioaspect_ratio4/31/1, 4/3, 3/2, 16/9 or 3/4.
Show labelsshow_labelstrueShow the label (or file name) under each image.

An image grid of six gallery images, three columns, with sunset.jpg selectedAn image grid of six gallery images, three columns, with sunset.jpg selected

columns: 3, aspect_ratio: 3/2.

Multiple selection ​

Turn on Allow multiple (multiple: true) to let editors pick more than one item. The value is then saved as a list:

yaml
sizes_buttons:
  - Small
  - Large

Set Max items (max_items) to cap the number of selections. Once the limit is reached, further picks are rejected and removing an item always works. The image grid shows a "2 of 3 selected" counter, and the dropdown shows 1/2 next to the input.

yaml
- handle: featured
  field:
    type: field_item_relationship
    display: Featured images
    source_field: gallery
    save_as: value
    input_type: image_grid
    multiple: true
    max_items: 3
    columns: 6
    aspect_ratio: 1/1
    show_labels: false

Six square image tiles, two selected, with "2 of 3 selected" belowSix square image tiles, two selected, with "2 of 3 selected" below

Image grid, multiple, max 3, labels hidden.

Multi-select dropdown showing "2 items selected", a 2/3 counter and chips for Bob and DaveMulti-select dropdown showing "2 items selected", a 2/3 counter and chips for Bob and Dave

Multi-select dropdown with a 2/3 counter.

In templates, loop over the selection. For Assets sources the field is already a list of assets. For other sources, use the fir tag pair:

antlers
{{ fir:reviewers }}
  <div class="card"><strong>{{ name }}</strong> · {{ email }}</div>
{{ /fir:reviewers }}

Switching an existing field to multiple (or back)

You can change multiple on a field that already has content. A single saved value is read as a one-item list. A list left over from multiple mode is read as its first item in single mode.

Checkboxes saved as index, a multiple button group, and a multi-select dropdown limited to 2Checkboxes saved as index, a multiple button group, and a multi-select dropdown limited to 2

Checkboxes (radio + multiple), a multi-select button group and a dropdown with max_items: 2.

Option image source for Grid rows ​

When the source items are objects (Grid rows, Replicator sets) that contain an Assets field, set Option image source to that field's handle. Each option then gets the row's image as a thumbnail, in the image grid and in the dropdown.

yaml
- handle: team_lead
  field:
    type: field_item_relationship
    display: Team lead
    source_field: team          # a Grid with name, role, email, photo
    option_label_source: name
    option_image_source: photo  # the Assets field inside each row
    save_as: object_key
    object_key: name
    input_type: image_grid
    columns: 4
    aspect_ratio: 1/1

Team members from a Grid as square image tiles with their namesTeam members from a Grid as square image tiles with their names

Grid rows with a photo become image tiles.
  • Dot notation works for nested keys, for example media.image.
  • If the Assets field holds several files, the first one is used.
  • This also works for Global sources: the images are loaded with the global's data.
  • Not needed when the source itself is an Assets field.

Labels ​

For object items, Option label source is the key to use as the label, for example name, or author.name with dot notation.

For anything more complex, use a string literal in back ticks. The item is available as o:

yaml
option_label_source: '`${o.name} — ${o.role}`'

Dropdown with labels like "Alice — Design lead" and "Carol — Editor", each with a photo thumbnailDropdown with labels like "Alice — Design lead" and "Carol — Editor", each with a photo thumbnail

A string-literal label combining two keys of each Grid row.

Without a label source, the field falls back to sensible defaults: the string itself for lists, the file name for assets, and the value for keyed Array sources.

Released under the MIT License. Made with fruit by kiwikiwi