A text input lets your team members add plain text to your data files or front matter.
There are four types of Text input:
- Text
- Textarea
- Disabled
For each input, you can configure how CloudCannon handles null values. For Textarea inputs, you can configure a character counter. You can also use the general configuration options available for all inputs.
Text#
The Text input provides a simple editing interface for plain text.
You can configure a Text input using the type
key with the value text
. Define the type
key under your input key name within _inputs
. For more information, please read our documentation on configuring your inputs.
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.
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.
Once configured, the Text input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.
Textarea#
The Textarea input provides a resizable editing interface for plain text.
You can configure a Textarea input using the type
key with the value textarea
. Define the type
key under your input key name within _inputs
. For more information, please read our documentation on configuring your inputs.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Textarea input is called page_description
.
The value of the type
key determines the input type. This is a textarea
Text input.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Textarea input is called page_description
.
The value of the type
key determines the input type. This is a textarea
Text input.
Once configured, the Textarea input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.
Email#
The Email input provides an editing interface for plain text with an email icon for context.
You can configure an Email input using the type
key with the value email
. Define the type
key under your input key name within _inputs
. For more information, please read our documentation on configuring your inputs.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Email input is called contact_address
.
The value of the type
key determines the input type. This is a email
Text input.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Email input is called contact_address
.
The value of the type
key determines the input type. This is a email
Text input.
Once configured, the Email input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.
Disabled#
The Disabled input is a single line of read-only plain text. The field for this input appears grayed-out, and you can only edit the value in the Source Editor.
You can configure a Disabled input using the type
key with the value disabled
. Define the type
key under your input key name within _inputs
. For more information, please read our documentation on configuring your inputs.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Disabled input is called author
.
The value of the type
key determines the input type. This is a disabled
Text input.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Disabled input is called author
.
The value of the type
key determines the input type. This is a disabled
Text input.
Once configured, the Disabled input will appear in the Data Editor or sidebar of the Visual or Content Editor when you add it to a data file or the front matter of a markup file.
Options#
You can configure Text inputs using the options
key under your input key, inside of _inputs
.
Text inputs have the following options available:
This key toggles a character counter.
Available for Textarea input only.
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.
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:
textarea
ordescription
, or that ends in_textarea
or_description
, as a Textarea input.email
oremail_address
, or that ends in_email
or_email_address
, as a Textarea 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.
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.
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 string
text: "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"