☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

max_length

Table of contents

Description:

This key defines the maximum string length, in characters, that CloudCannon will allow in an Input.

When configured, CloudCannon will warn you when an Input value is too long.

If the Input already contains a longer value, CloudCannon will require you to remove characters until the Input contains a valid string to save your changes, or discard your unsaved changes.

Value can be any non-negative integer.

If this key is set to 0, CloudCannon requires the Input to be empty.

If options.min_length is also configured, this key cannot be a smaller number.

This key has no default.

This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.

To use this key in a Select Input, allow_create must be set to true.

Appears in:
└── _inputs
    └── *
        ├── Text Input
        │   └── options
        │       └── max_length
        ├── Textarea Input
        │   └── options
        │       └── max_length
        ├── Code Input
        │   └── options
        │       └── max_length
        ├── Color Input
        │   └── options
        │       └── max_length
        ├── Rich Text Input
        │   └── options
        │       └── max_length
        ├── File Input
        │   └── options
        │       └── max_length
        ├── URL Input
        │   └── options
        │       └── max_length
        ├── Select Input
        │   └── options
        │       └── max_length
        └── Choice Input
            └── options
                └── max_length
Type:
number
Examples:

In this example, we want our team to enter a blog description using the Rich Text seo_description Input. This Input limits you to a maximum of 125 characters.

Copied to clipboard
_inputs:
  seo_description:
    type: markdown
    comment: Enter a brief description of this blog.
    options:
      max_length: 125
      min_length: 25
{
  "_inputs": {
    "seo_description": {
      "type": "markdown",
      "comment": "Enter a brief description of this blog.",
      "options": {
        "max_length": 125,
        "min_length": 25
      }
    }
  }
}
Open in a new tab