A Boolean input is an editing interface for structured data with true or false values in data files or front matter. By configuring your inputs, you can customize the appearance and functionality for a better editing experience.


For a complete list of configuration keys available for inputs please read our inputs reference documentation.
These instructions assume that you know what type of Boolean input you want to configure and where in the configuration cascade. For more information, please read our documentation on Boolean inputs, inputs in general, and the configuration cascade.
To configure a Boolean 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, a markup file, or any where you configure a Structure. - Identify the
_inputs
key, or create one at that level of the configuration cascade. - Add an input name key for your input under the
_inputs
key (a.k.a.,_inputs.*
). We recommend naming your input something simple that indicates the function or context. - Add the
type
key under your input name key, with either thecheckbox
orswitch
value. - (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.,required
).
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_published:
type: checkbox
featured:
type: switch
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Boolean input is called blog_published
.
The value of the type
key determines the input type. This is a checkbox
Boolean input.
This Boolean input is called featured
.
The value of the type
key determines the input type. This is a switch
Boolean input.
{
"_inputs": {
"blog_published": {
"type": "checkbox"
},
"featured": {
"type": "switch"
}
}
}
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Boolean input is called blog_published
.
The value of the type
key determines the input type. This is a checkbox
Boolean input.
This Boolean input is called featured
.
The value of the type
key determines the input type. This is a switch
Boolean input.
When you add your input key name to a data or markup file, your configured Boolean input will appear in the Data Editor, Visual Editor, or Content Editor.
---
blog_published: true
featured: false
---
Blog content goes here.
Input configuration options#
General configuration options are available for all input types. You can define the label, comment, and context box for your Boolean input, whether it is hidden or disabled, and how CloudCannon should handle configuration at multiple levels of the configuration cascade.
Boolean inputs are simple. There are no specific configuration options for Boolean inputs.
Here is an example of a Boolean input using some of the most commonly used configuration keys.
_inputs:
blog_published:
type: checkbox
label: Published
comment: This blog will appear on our website when this box is checked
{
"_inputs": {
"blog_published": {
"type": "checkbox",
"label": "Published",
"comment": "This blog will appear on our website when this box is checked"
}
}
}
Valid values#
Here are some examples of valid values for the key available
. These work for both Checkbox and Switch inputs.
Empty/null value:
available:
Boolean values (without any quotation marks):
available: true
available: false
Boolean values (without any quotation marks):
available = true
available = false
Null value:
"available": null
Boolean values (without any quotation marks):
"available": true
"available": false
Unconfigured Boolean inputs#
In some cases, CloudCannon can still detect a Boolean input even if you have not configured it.
CloudCannon will interpret any unconfigured input with a true
or false
value as a Checkbox Boolean input. CloudCannon cannot create a Switch input without configuration.
---
public: true
---
Content goes here.
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.