- Description:
This key defines options that are specific to Text Inputs.
- Appears in:
└── _inputs └── * └── Text Input └── options- Type:
Object- Properties:
This key defines how an 'empty' value will be saved. Does not apply to existing empty values.
Defaults to:
nullAllowed values:
nullstringThis key defines the icon shown beside the input.
Allowed values:
12336010k10mp11mp12mp13mp14mp15mp16mpand 3574 more.Show examplesHide examples
In this example, we have configured an icon for the Text Input
title.Copied to clipboard_inputs: title: type: text options: icon: title{ "_inputs": { "title": { "type": "text", "options": { "icon": "title" } } } }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.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_colorfirst, then fall back to the static hex color value.Copied to clipboard_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.
Copied to clipboard_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" } ] } } } }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.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_colorfirst, then fall back to the static hex color value.Copied to clipboard_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.
Copied to clipboard_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 locale that CloudCannon uses to determine the number of words or graphemes in this Input, if you have
max_words,min_words,max_graphemes, ormin_graphemesconfigured.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.
This key defines the message that explains which maximum string length an Input will accept. This key requires you to define `options.max_graphemes.
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_lengthis 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_createmust be set totrue.Show examplesHide examples
In this example, we want our team to enter a blog description using the Rich Text
seo_descriptionInput. 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 } } } }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.
Show examplesHide examples
In this example, we prompt our team to enter a valid number of characters using a custom message.
Copied to clipboard_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.
This key defines the message that explains which maximum string length an Input will accept. This key requires you to define `options.max_words.
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.
This key defines the message that explains which minimum string length an Input will accept. This key requires you to define
options.min_graphemes.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_lengthis 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_createmust be set totrue.Show examplesHide examples
In this example, we want our team to enter a blog description using the Rich Text
seo_descriptionInput. This Input requires a minimum of 25 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 } } } }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.
Show examplesHide examples
In this example, we prompt our team to enter a valid number of characters using a custom message.
Copied to clipboard_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.
This key defines the message that explains which minimum string length an Input will accept. This key requires you to define
options.min_words.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.ymlfile, 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_createmust be set totrue.Show examplesHide examples
In this example, we want our team to add an email address to the
contact_emailInput using the correct email format.Copied to clipboard_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.Show examplesHide examples
In this example, we have configured pattern flags for a text input to enable case-insensitive searching.
Copied to clipboard_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 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.
Show examplesHide examples
In this example, we prompt our team to use the correct email format in the
contact_emailInput using a pattern message.Copied to clipboard_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.
Show examplesHide examples
In this example, we have configured a placeholder for a Text Input.
Copied to clipboard_inputs: title: type: text options: placeholder: Enter a title{ "_inputs": { "title": { "type": "text", "options": { "placeholder": "Enter a title" } } } }This key toggles whether CloudCannon requires this Input to have a value.
Setting this key to
truewill 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:
falseShow examplesHide examples
In this example, we want to require our team to enter an
authorvalue for markup files with this Input.Copied to clipboard_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.
Show examplesHide examples
In this example, we prompt our team to use enter an Input value using a required message.
Copied to clipboard_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." } } } }- Examples:
In this example, we have configured Text Input options including comment and icon.
Copied to clipboard_inputs: title: type: text options: comment: Enter a title icon: title{ "_inputs": { "title": { "type": "text", "options": { "comment": "Enter a title", "icon": "title" } } } }