- Description:
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_itemsis 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.
- Appears in:
└── _inputs └── * ├── Multiselect Input │ └── options │ └── max_items ├── Multichoice Input │ └── options │ └── max_items └── Array Input └── options └── max_items- Type:
number- Examples:
In this example, we want to add an array of filepaths to our homepage's
featured_postsInput. This Input limits you to a maximum of five array items.Copied to clipboard_inputs: featured_posts: type: array options: max_items: 5 max_items_message: Cannot be more than 5 min_items: 2 min_items_message: Cannot be less than 2{ "_inputs": { "featured_posts": { "type": "array", "options": { "max_items": 5, "max_items_message": "Cannot be more than 5", "min_items": 2, "min_items_message": "Cannot be less than 2" } } } }