A Text input is an editing interface for plain text content. By configuring your inputs, you can customize the appearance and functionality for a better editing experience.

These instructions assume that you know what type of Text input you want to configure and where in the configuration cascade. For more information, please read our documentation on Text inputs, inputs in general, and the configuration cascade.
To configure a Text input:
- 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.
- 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, the frontmatter of a markup file, or any where you configure a Structure. - Identify the
_inputskey, or create one at that level of the configuration cascade. - Add an input name key for your input under the
_inputskey (a.k.a.,_inputs.*). We recommend naming your input something simple that indicates the function or context. - Add the
typekey under your input name key, with the valuetext,textarea, oremail. - (Optional.) Add any other general configuration keys (e.g.,
label,comment,context) under your input name key. - (Optional.) Add any specific configuration keys under
_inputs.*.options(e.g.,show_count,empty_type).
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.
_inputs:
blog_title:
type: text
page_description:
type: textarea
contact_address:
type: email{
"_inputs": {
"blog_title": {
"type": "text"
},
"page_description": {
"type": "textarea"
},
"contact_address": {
"type": "email"
}
}
}All inputs are defined under the _inputs key, regardless of where they are in the configuration cascade.
This Text input is called blog_title.
The value of the type key determines the input type. This is a text input.
This Textarea input is called page_description.
The value of the type key determines the input type. This is a textarea Text input.
This Email input is called contact_address.
The value of the type key determines the input type. This is a email Text input.
When you add your input key name to a data or markup file, your configured Text input will appear in the Data Editor, Visual Editor, or Content Editor.
blog_title: The benefits of static sites
page_description: This page is about how to configure your inputs.
contact_address: support@cloudcannon.comInput configuration options#
General configuration options are available for all input types. You can define the label, comment, and context box for your Text input, whether it is hidden or disabled, and how CloudCannon should handle configuration at multiple levels of the configuration cascade.
Specific configuration options for Text inputs include configuring how CloudCannon handles empty values. You can also add input validation to require a value, specify the minimum and maximum value length, or match a regular expression. For Textarea inputs, you can configure a character counter.
Here is an example of a Text input using some of the most commonly used configuration keys.
_inputs:
seo_description:
type: textarea
label: SEO Description
comment: Enter a description for search engines
options:
show_count: true
empty_type:
required: true
max_length: 160{
"_inputs": {
"seo_description": {
"type": "textarea",
"label": "SEO Description",
"comment": "Enter a description for search engines",
"options": {
"show_count": true,
"empty_type": null,
"required": true,
"max_length": 160
}
}
}
}For a complete list of configuration keys available for inputs please read our Inputs reference documentation.
These keys configure the appearance and functionality of Text inputs in CloudCannon.
This key defines how an 'empty' value will be saved. Does not apply to existing empty values.
Defaults to: null
Allowed values: null string
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, Date/Datetime Input options, Time Input options, File Input options, Choice Input options.
This key defines the icon shown beside the input.
The value must be an icon name from Google's Material Symbols.
Allowed values: 123 360 10k 10mp 11mp 12mp 13mp 14mp 15mp 16mp and 3574 more.
Appears in: Text Input options.
Show examplesHide examples
In this example, we have configured an icon for the Text Input title.
_inputs:
title:
type: text
options:
icon: title{
"_inputs": {
"title": {
"type": "text",
"options": {
"icon": "title"
}
}
}
}options.icon_background_colorArray Preview Entry|Key Preview Entry|Template Preview Entry|Text Preview Entry|Raw Text Preview Entry|False Preview Entry#This key defines the background color of the icon displayed beside a Text Input.
The value can be an array or a single value, and reference a key, template, or text string. When multiple entries are provided, CloudCannon will use them in order as fallback options.
Color values can be hex codes (e.g., #ff0000), CSS color names, or reference a data key that contains a color value.
Appears in: Text Input options.
Show examplesHide examples
In this example, we have configured the icon background color for a text input with an array of values to provide fallback options. CloudCannon will use the value of icon_bg_color first, then fall back to the static hex color value.
_inputs:
email_address:
type: text
label: Email
options:
icon: email
icon_background_color:
- key: icon_bg_color
- text: '#e3f2fd'{
"_inputs": {
"email_address": {
"type": "text",
"label": "Email",
"options": {
"icon": "email",
"icon_background_color": [
{
"key": "icon_bg_color"
},
{
"text": "#e3f2fd"
}
]
}
}
}
}In this example, we have configured the icon background color to use a static CSS color value.
_inputs:
phone_number:
type: text
label: Phone
options:
icon: phone
icon_background_color:
- text: lightblue{
"_inputs": {
"phone_number": {
"type": "text",
"label": "Phone",
"options": {
"icon": "phone",
"icon_background_color": [
{
"text": "lightblue"
}
]
}
}
}
}options.icon_colorArray Preview Entry|Key Preview Entry|Template Preview Entry|Text Preview Entry|Raw Text Preview Entry|False Preview Entry#This key defines the color of the icon displayed beside a Text Input.
The value can be an array or a single value, and reference a key, template, or text string. When multiple entries are provided, CloudCannon will use them in order as fallback options.
Color values can be hex codes (e.g., #ff0000), CSS color names, or reference a data key that contains a color value.
Appears in: Text Input options.
Show examplesHide examples
In this example, we have configured the icon color for a text input with an array of values to provide fallback options. CloudCannon will use the value of icon_color first, then fall back to the static hex color value.
_inputs:
email_address:
type: text
label: Email
options:
icon: email
icon_color:
- key: icon_color
- text: '#2196F3'{
"_inputs": {
"email_address": {
"type": "text",
"label": "Email",
"options": {
"icon": "email",
"icon_color": [
{
"key": "icon_color"
},
{
"text": "#2196F3"
}
]
}
}
}
}In this example, we have configured the icon color to use a static CSS color value.
_inputs:
phone_number:
type: text
label: Phone
options:
icon: phone
icon_color:
- text: blue{
"_inputs": {
"phone_number": {
"type": "text",
"label": "Phone",
"options": {
"icon": "phone",
"icon_color": [
{
"text": "blue"
}
]
}
}
}
}This key defines the maximum string length, in graphemes, 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.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the message that explains which maximum string length an Input will accept. This key requires you to define `options.max_graphemes.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
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: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide 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.
_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
}
}
}
}This key defines a custom error message that explains why a value has failed the validation criteria from options.max_length.
This key requires you to define options.max_length.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we prompt our team to enter a valid number of characters using a custom message.
_inputs:
seo_description:
type: markdown
comment: Enter a brief description of this blog.
options:
max_length: 125
max_length_message: You are only allowed 125 characters.
min_length: 25
min_length_message: Please write more than 25 characters.{
"_inputs": {
"seo_description": {
"type": "markdown",
"comment": "Enter a brief description of this blog.",
"options": {
"max_length": 125,
"max_length_message": "You are only allowed 125 characters.",
"min_length": 25,
"min_length_message": "Please write more than 25 characters."
}
}
}
}This key defines the maximum string length, in words, 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.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the message that explains which maximum string length an Input will accept. This key requires you to define `options.max_words.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the minimum string length, in graphemes, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too short. If the Input already contains a shorter value, CloudCannon will require you to add characters until the Input contains a valid string to save your changes, or discard your unsaved changes.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the message that explains which minimum string length an Input will accept. This key requires you to define options.min_graphemes.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the minimum string length, in characters, that CloudCannon will allow in an Input.
When configured, CloudCannon will warn you when an Input value is too short.
If the Input already contains a shorter value, CloudCannon will require you to add characters until the Input contains a valid string to save your changes, or discard your unsaved changes.
Value can be any positive integer.
If options.max_length is also configured, this key cannot be a greater 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: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we want our team to enter a blog description using the Rich Text seo_description Input. This Input requires a minimum of 25 characters.
_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
}
}
}
}This key defines a custom error message that explains why a value has failed the validation criteria from options.min_length.
This key requires you to define options.min_length.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we prompt our team to enter a valid number of characters using a custom message.
_inputs:
seo_description:
type: markdown
comment: Enter a brief description of this blog.
options:
max_length: 125
max_length_message: You are only allowed 125 characters.
min_length: 25
min_length_message: Please write more than 25 characters.{
"_inputs": {
"seo_description": {
"type": "markdown",
"comment": "Enter a brief description of this blog.",
"options": {
"max_length": 125,
"max_length_message": "You are only allowed 125 characters.",
"min_length": 25,
"min_length_message": "Please write more than 25 characters."
}
}
}
}This key defines the minimum string length, in words, that CloudCannon will allow in an Input. When configured, CloudCannon will warn you when an Input value is too short. If the Input already contains a shorter value, CloudCannon will require you to add characters until the Input contains a valid string to save your changes, or discard your unsaved changes.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines the message that explains which minimum string length an Input will accept. This key requires you to define options.min_words.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
This key defines a regular expression that the Input value must match.
When configured, CloudCannon will require you to enter a value that matches the REGEX pattern.
If the Input already contains an invalid value, CloudCannon will require you to enter a valid string to save your changes, or discard your unsaved changes.
Value must be a valid REGEX string.
If your REGEX string includes a \ character and CloudCannon Configuration File is a .yml file, use single quotes ' around the string to avoid a
build error.
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: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we want our team to add an email address to the contact_email Input using the correct email format.
_inputs:
contact_email:
type: email
options:
pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
pattern_message: Please use the format ___@___.__{
"_inputs": {
"contact_email": {
"type": "email",
"options": {
"pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
"pattern_message": "Please use the format ___@___.__"
}
}
}
}This key defines the flags (e.g. case-insensitive searching) for the regular expression set in options.pattern.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we have configured pattern flags for a text input to enable case-insensitive searching.
_inputs:
search_term:
type: text
options:
pattern: ^[a-z]+$
pattern_flags:
ignore_case: true{
"_inputs": {
"search_term": {
"type": "text",
"options": {
"pattern": "^[a-z]+$",
"pattern_flags": {
"ignore_case": true
}
}
}
}
}This key defines the s flag - . matches newline characters.
Defaults to: false
Appears in: pattern_flags.
This key defines the m flag - ^ and $ match the start and end of each line rather than the entire string.
Defaults to: false
Appears in: pattern_flags.
This key defines the u flag - Pattern is treated as a sequence of Unicode code points.
Defaults to: false
Appears in: pattern_flags.
This key defines a custom error message that explains why a value has failed the validation criteria from options.pattern.
This key requires you to define options.pattern.
This key has no default.
This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, URL Input options, Select Input options, Rich Text Input options, File Input options, Choice Input options.
Show examplesHide examples
In this example, we prompt our team to use the correct email format in the contact_email Input using a pattern message.
_inputs:
contact_email:
type: email
options:
pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
pattern_message: Please use the format ___@___.__{
"_inputs": {
"contact_email": {
"type": "email",
"options": {
"pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
"pattern_message": "Please use the format ___@___.__"
}
}
}
}This key defines the text shown when this input has no value.
Appears in: Text Input options.
Show examplesHide examples
In this example, we have configured a placeholder for a Text Input.
_inputs:
title:
type: text
options:
placeholder: Enter a title{
"_inputs": {
"title": {
"type": "text",
"options": {
"placeholder": "Enter a title"
}
}
}
}This key defines the text shown when this input has no value.
Appears in: Textarea Input options.
Show examplesHide examples
In this example, we have configured a placeholder for a Textarea Input.
_inputs:
description:
type: textarea
options:
placeholder: Enter a description{
"_inputs": {
"description": {
"type": "textarea",
"options": {
"placeholder": "Enter a description"
}
}
}
}This key toggles whether CloudCannon requires this Input to have a value.
Setting this key to true 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, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.
Defaults to: false
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, Number Input options, Range Input options, URL Input options, Select Input options, Rich Text Input options, Date/Datetime Input options, Time Input options, File Input options, Multiselect Input options, Choice Input options, Multichoice Input options, Object Input options, Array Input options.
Show examplesHide examples
In this example, we want to require our team to enter an author value for markup files with this Input.
_inputs:
author:
type: text
comment: Enter the name of the author for this blog post.
options:
required: true{
"_inputs": {
"author": {
"type": "text",
"comment": "Enter the name of the author for this blog post.",
"options": {
"required": true
}
}
}
}This key defines a custom error message that explains why a value has failed the validation criteria from options.required.
This key requires you to define options.required.
This key has no default.
This key is available for Array, Code, Color, Date and Time, File, Number, Object, Select and Multiselect, Text, Rich Text, and URL Inputs.
Appears in: Text Input options, Textarea Input options, Code Input options, Color Input options, Number Input options, Range Input options, URL Input options, Select Input options, Rich Text Input options, Date/Datetime Input options, Time Input options, File Input options, Multiselect Input options, Choice Input options, Multichoice Input options, Object Input options, Array Input options.
Show examplesHide examples
In this example, we prompt our team to enter an Input value using a required message.
_inputs:
author:
type: text
comment: Enter the name of the author for this blog post.
options:
required: true
required_message: You are not allowed to leave this blank.{
"_inputs": {
"author": {
"type": "text",
"comment": "Enter the name of the author for this blog post.",
"options": {
"required": true,
"required_message": "You are not allowed to leave this blank."
}
}
}
}This key toggles whether a character counter is shown below the input.
Setting this key to true will show a character counter below the input.
Defaults to: false
Appears in: Textarea Input options.
Show examplesHide examples
In this example, CloudCannon will show a character counter below the Textarea Input.
_inputs:
description:
type: textarea
options:
show_count: true{
"_inputs": {
"description": {
"type": "textarea",
"options": {
"show_count": true
}
}
}
}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.
This key is available for Array inputs.
Appears in: Multiselect Input options, Multichoice Input options, Array Input options.
Show examplesHide examples
In this example, we want our team to add article filepaths to the related_articles Input. This Input requires all the filepaths to be unique.
_inputs:
related_articles:
type: array
options:
unique_on: $.path{
"_inputs": {
"related_articles": {
"type": "array",
"options": {
"unique_on": "$.path"
}
}
}
}related_articles:
- path: /articles/first-article.md
featured: true
- path: /articles/second-article.md
featured: false{
"related_articles": [
{
"path": "/articles/first-article.md",
"featured": true
},
{
"path": "/articles/second-article.md",
"featured": false
}
]
}This key defines a custom error message that explains why a value has failed the validation criteria from options.unique_on.
This key requires you to define options.unique_on.
This key has no default.
This key is available for Array inputs.
Appears in: Multiselect Input options, Multichoice Input options, Array Input options.
Show examplesHide examples
In this example, we want our team to add article filepaths to the related_articles Input. This Input requires all the filepaths to be unique.
_inputs:
related_articles:
type: array
options:
unique_on: $.path
unique_on_message: The value for path must be different for all items.{
"_inputs": {
"related_articles": {
"type": "array",
"options": {
"unique_on": "$.path",
"unique_on_message": "The value for path must be different for all items."
}
}
}
}related_articles:
- path: /articles/first-article.md
featured: true
- path: /articles/first-article.md
featured: false{
"related_articles": [
{
"path": "/articles/first-article.md",
"featured": true
},
{
"path": "/articles/first-article.md",
"featured": false
}
]
}Valid values#
Text inputs can have multiple valid values for empty, single line, and multiline content. Here are some examples of valid values for the key text. These work for Text, Textarea, and Email inputs.
Empty/null value:
text:
Any valid string (quoted or unquoted):
text: ""text: ''text: any stringtext: "any string"text: 'any string'
Any valid multiline string:
-
text: >
multiline string -
text: >-
multiline string -
text: >+
multiline string -
text: |
multiline string -
text: |-
multiline string -
text: |+
multiline string
Any valid string:
text = ""text = "any string"
Any valid escaped string:
text = ''text = 'any string (literal)'
Any valid multiline string:
-
text = """
multiline string""" -
text = """\
multiline string (trimmed) \
""" -
text = '''
literal multiline string'''
Null value:
"text": null
Any valid string:
"text": """text": "any string"
Any valid multiline string:
"text": "multiline \n string"
Unconfigured Text inputs#
In some cases, CloudCannon can still detect a Text input even if you have not configured it.
CloudCannon will interpret any unconfigured input with the key name:
textareaordescription, or that ends in_textareaor_description, as a Textarea input.emailoremail_address, or that ends in_emailor_email_address, as an Email input.
CloudCannon will interpret any unconfigured input with a string value as a Text input, provided that the key name does not match the naming convention for any other input type.
image_description: A beautiful forest sceneThis 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.