Configure an Array input

Last modified: June 19th, 2025

Permissions required

Members of all Default Permission Groups, or Custom Permission Groups with the site:file:write permission, can configure inputs in all locations in the configuration cascade. You can limit permission to specific locations in the configuration using file globs.

An Array input is an editing interface for lists of structured data in data files or front matter. By configuring your inputs, you can customize the appearance and functionality for a better editing experience.

A screenshot of the Array input in the Data Editor, showing a preview of the content within multiple entries.

These instructions assume that you know how you want to populate the values of your Array input, and where you want to configure it in the configuration cascade. For more information, please read our documentation on Array inputs, inputs in general, populating an Array input, and the configuration cascade.

To configure an Object input:

  1. Open your website files in your local development environment, or log in to CloudCannon and select the Site for which you want to configure your input.
  2. Navigate to the location in the configuration cascade where you want to configure your input. This can be the root of your CloudCannon Configuration File, within the collections_config.* key in your CloudCannon Configuration File, a Schema file, a markup file, or any where you configure a Structure.
  3. Identify the _inputs key, or create one at that level of the configuration cascade.
  4. Add an input name key for your input under the _inputs key (a.k.a., _inputs.*). We recommend naming your input something simple that indicates the function or context.
  5. Add the type key under your input name key, with the value array.
  6. (Optional.) Add any other general configuration keys (e.g., label, comment, context) under your input name key.
  7. Define how CloudCannon should populate your input by adding the structures key under _inputs.*.options, or adding an empty input type.
  8. (Optional.) Add any other specific configuration keys under _inputs.*.options (e.g., preview, value_key, allow_empty).

CloudCannon will now apply this input configuration to all markup files that use your input name key, without needing to save your configuration. This allows you to make changes to your input configuration and see those changes affect inputs live.

When you are happy with your input configuration, you must save your input configuration.

cloudcannon.config.yaml
copied
_inputs:
  staff:
    type: array
    options:
      structures: _structures.staff_members

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Array input is called staff.

The value of the type key determines the input type. This is an array input.

The structures key determines what should populate the input. In this case, it references the structure called staff_members defined under _structures elsewhere in the configuration cascade.

cloudcannon.config.json
copied
{
  "_inputs": {
    "staff": {
      "type": "array",
      "options": {
        "structures": "_structures.staff_members"
      }
    }
  }
}

All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.

This Array input is called staff.

The value of the type key determines the input type. This is an array input.

The structures key determines what should populate the input. In this case, it references the structure called staff_members defined under _structures elsewhere in the configuration cascade.

When you add your input key name to a data or markup file, your configured Array input will appear in the Data Editor, Visual Editor, or Content Editor.

page.md
copied

---
staff:
  - name: Karen Key
    position: Project Manager
    image: /images/team/karen_key.jpg
  - name: Holly James
    position: Engineering Team Lead
    image: /images/team/holly_james.jpg
---

Page content goes here.

To allow team members to populate an Array, your input must have at least one item, an entry input type, or a structure.

Input configuration options#

General configuration options are available for all input types. You can define the label, comment, and context box for your Array input, whether it is hidden or disabled, and how CloudCannon should handle configuration at multiple levels of the configuration cascade.

Specific configuration options for Array inputs include defining structures, configuring previews, and how CloudCannon handles empty values. You can also add input validation to require a value, specify the minimum and maximum number of items, or match a regular expression.

Here is an example of an Array input using some of the most commonly used configuration keys.

cloudcannon.config.yaml
copied
_inputs:
  page_sections:
    type: array
    options:
      structures: _structures.components
      preview:
        text:
          - key: name
        subtext:
          - key: description
        image:
          - key: my_image
        icon: article
      min_items: 3
      max_item: 5
      required: true
cloudcannon.config.json
copied
{
  "_inputs": {
    "page_sections": {
      "type": "array",
      "options": {
        "structures": "_structures.components",
        "preview": {
          "text": [
            {
              "key": "name"
            }
          ],
          "subtext": [
            {
              "key": "description"
            }
          ],
          "image": [
            {
              "key": "my_image"
            }
          ],
          "icon": "article"
        },
        "min_items": 3,
        "max_item": 5,
        "required": true
      }
    }
  }
}

For a complete list of configuration keys available for inputs please read our inputs reference documentation.

These keys configure the appearance and functionality of Object inputs in CloudCannon.

structures — String or object#

This key determines which predefined templates to use for populating the Object Input. When configured, team members can select a structure to populate the Object with input/input groups. This key has no default.

If configured as an object, CloudCannon will use the values directly.

If configured as a string, CloudCannon will use the matching structures value defined under _structures in the configuration cascade.

preview — object#

This key enables you to define the appearance of the input in the Data Editor or sidebar of the Visual or Content Editor. The following nested keys are available:

  • text
  • subtext
  • icon
  • image

If the Array Input uses structures, CloudCannon will use the preview key from the structure instead.

For more information about previews, please read our documentation on configuring card previews.

preview.text — array, string, or boolean#

This key determines the title text displayed on a default Array Input card(s). This key has no default, and falls back to the first nested value found (prioritizing text-based values).

If set to false, no text is displayed.

preview.subtext — array, string, or boolean#

This key determines the subtitle text displayed on a default Array Input card(s). This key has no default, and falls back to listing the label of each nested input. subtext is hidden if text and subtext are the same. If there is no text, subtext will appear in the place of text.

If set to false, no text is displayed.

preview.icon — array, string, or boolean#

This key determines the icon displayed on a default Array Input card(s). The value must match a name from the Material Icons list. Defaults checking the icon key, then falls back to the notes icon.

If set to false, no icon is displayed.

If image is defined, the image replace icon when loaded successfully.

preview.image — array, string, or boolean#

This key determines the image displayed on a default Array Input card(s). This key has no default, and falls back to thumbnail_image, thumbnail_image_path, image, and image_path in that order. If no image is found, icon is displayed instead.

If set to false, no image is displayed.

empty_type — String#

This key determines how CloudCannon handles an empty value. This key does not apply to existing empty values.

Value must be one of the following:

  • string - an empty value for this input will be stored as "".
  • null - an empty value for this input will be stored as a null value (default). This does not apply to TOML files.
_inputs.*.options.required — Boolean#

This key toggles whether CloudCannon requires this Input to have a value. If set to true, CloudCannon will require you to enter a value to save your changes, or discard your unsaved changes.

By default, this key is false (i.e, CloudCannon does not require this Input to have a value).

This key is available for Array, Boolean, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.

Show exampleHide example

In this example, we want to require our team to enter an author value for markup files with this Input.

cloudcannon.config.yaml
copied
_inputs:
  author:
    type: text
    comment: Enter the name of the author for this blog post.
    options:
      required: true
cloudcannon.config.json
copied
{
  "_inputs": {
    "author": {
      "type": "text",
      "comment": "Enter the name of the author for this blog post.",
      "options": {
        "required": true
      }
    }
  }
}
_inputs.*.options.max_items — Number#

This key defines the maximum number of items CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from adding more items to this Input. If the Input already contains more items, CloudCannon will require you to remove items until the Input contains a valid number to save your changes, or discard your unsaved changes.

Value can be any positive integer. If options.min_items is also configured, this key cannot be a lesser number.

This key has no default.

This key is available for Array and Multiselect or Multichoice Inputs.

Show exampleHide example

In this example, we want to add an array of filepaths to our homepage's featured_posts Input. This Input limits you to a maximum of five array items.

cloudcannon.config.yaml
copied
_inputs:
  featured_posts:
    type: array
    options:
      min_items: 2
      max_items: 5
cloudcannon.config.json
copied
{
  "_inputs": {
    "featured_posts": {
      "type": "array",
      "options": {
        "min_items": 2,
        "max_items": 5
      }
    }
  }
}
_inputs.*.options.min_items — Number#

This key defines the minimum number of items CloudCannon will allow in an Input. When configured, CloudCannon will prevent you from removing items from this Input below this value. If the Input already contains fewer items, CloudCannon will require you to add items until the Input contains a valid number to save your changes, or discard your unsaved changes.

Value can be any positive integer. If options.min_items is also configured, this key cannot be a greater number.

This key has no default.

This key is available for Array and Multiselect or Multichoice Inputs.

Show exampleHide example

In this example, we want to add an array of filepaths to our homepage's featured_posts Input. This Input limits you to a maximum of two array items.

cloudcannon.config.yaml
copied
_inputs:
  featured_posts:
    type: array
    options:
      min_items: 2
      max_items: 5
cloudcannon.config.json
copied
{
  "_inputs": {
    "featured_posts": {
      "type": "array",
      "options": {
        "min_items": 2,
        "max_items": 5
      }
    }
  }
}
_inputs.*.options.unique_on — String#

This key defines the JSON Path selector that CloudCannon should use to determine if the value of an Input is unique. When configured, CloudCannon will require the value of the Input to be unique compared to the value defined on the JSON Path. If the Input already contains a non-unique value, CloudCannon will require you to change it to a valid value to save your changes, or discard your unsaved changes.

Value must be a valid JSON Path.

This key has no default.

Show exampleHide example

In this example, CloudCannon will provide items in the posts Collection as values for the heathers_posts input. CloudCannon will also apply a filter, returning only files where the author structured data key is equal to "Heather".

cloudcannon.config.yaml
copied
_inputs:
  heathers_posts:
    type: multiselect
    label: Heather's Posts
    options:
      values: collections.posts[?(@.author == 'Heather')]
cloudcannon.config.json
copied
{
  "_inputs": {
    "heathers_posts": {
      "type": "multiselect",
      "label": "Heather's Posts",
      "options": {
        "values": "collections.posts[?(@.author == 'Heather')]"
      }
    }
  }
}
_inputs.*.options.disable_add — Boolean#

This key toggles whether you can add new items to an Array Input. When set to true, the "Add" button is disabled in editing interfaces.

By default, this key is false (i.e., users can add new items to the array).

Show exampleHide example

In this example, we have a content_blocks Array Input where users cannot add entries to the Array.

cloudcannon.config.yaml
copied
_inputs:
  content_blocks:
    type: array
    label: Categories
    options:
      disable_add: true
      disable_remove: true
cloudcannon.config.json
copied
{
  "_inputs": {
    "content_blocks": {
      "type": "array",
      "label": "Categories",
      "options": {
        "disable_add": true,
        "disable_remove": true
      }
    }
  }
}
_inputs.*.options.disable_remove — Boolean#

This key toggles whether you can remove items from an Array Input. When set to true, CloudCannon will remove the "Delete" option from the Context Menu for each entry.

By default, this key is false (i.e., users can remove items from the array).

Show exampleHide example

In this example, we have a content_blocks Array Input where users cannot remove entries from the Array.

cloudcannon.config.yaml
copied
_inputs:
  content_blocks:
    type: array
    label: Categories
    options:
      disable_add: true
      disable_remove: true
cloudcannon.config.json
copied
{
  "_inputs": {
    "content_blocks": {
      "type": "array",
      "label": "Categories",
      "options": {
        "disable_add": true,
        "disable_remove": true
      }
    }
  }
}
_inputs.*.options.disable_reorder — Boolean#

This key toggles whether you can reorder items within an Array Input. When set to true, CloudCannon will disable the drag-and-drop reordering functionality and remove the "Move Up" and "Move Down" options from the Context Menu for each entry.

By default, this key is false (i.e., users can reorder items in the array).

Show exampleHide example

In this example, we have a staff Array Input where users cannot reorder the items.

cloudcannon.config.yaml
copied
_inputs:
  staff:
    type: array
    label: Our Team
    options:
      disable_reorder: true
cloudcannon.config.json
copied
{
  "_inputs": {
    "staff": {
      "type": "array",
      "label": "Our Team",
      "options": {
        "disable_reorder": true
      }
    }
  }
}

Valid values#

Here are some examples of valid values for an Array input.

Empty/null value:

  • array:

Any valid list of values:

array:
  - value1
  - value2
  - value3

Any valid list of objects:

array:
  - name: Item 1
    description: First item
  - name: Item 2
    description: Second item

Any valid array of values:

array = ["value1", "value2", "value3"]

Any valid array of tables:

[[array]]
name = "Item 1"
description = "First item"

[[array]]
name = "Item 2"
description = "Second item"

Empty/null value:

  • "array": null

Any valid array of values:

{
                                  "array": [
                                    "value1",
                                    "value2",
                                    "value3"
                                  ]
                                }

Any valid array of objects:

{
                                  "array": [
                                    {
                                      "name": "Item 1",
                                      "description": "First item"
                                    },
                                    {
                                      "name": "Item 2",
                                      "description": "Second item"
                                    }
                                  ]
                                }

Unconfigured Array inputs#

In some cases, CloudCannon can still detect an Array input even if you have not configured it.

CloudCannon will interpret any unconfigured input with a list of nested values or keys as an Array input. You cannot create structured Array inputs without configuration.

data.yml
copied

animals:
  - bear
  - lizard
  - swan
  - name: Dog
    fun_fact: Man's best friend.
    image: /images/my-dog.png

This behavior is convenient if you have simple inputs or do not want to configure inputs. It is also beneficial for new websites on CloudCannon where you have yet to create any CloudCannon-specific configuration.

We recommend configuring your inputs for greater control over their functionality and appearance.

Open in a new tab