A Number input lets your team members store numerical information in your data files or the front matter of markup files.
There are two types of Number input:
- Number
- Range
For each input, you can configure the minimum and maximum permitted value, the step value for increasing or decreasing the value, and how CloudCannon handles empty values.
You can also use the general configuration options available for all inputs.
Number#
The Number input provides an editing interface for numerical data.
You can configure a Number input using the type
key with the value number
. 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 Number input is called series
.
The value of the type
key determines the input type. This is a number
input.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Number input is called series
.
The value of the type
key determines the input type. This is a number
input.
Once configured, the Number 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.
Range#
The Range input provides an editing interface for numerical data, using a sliding scale to adjust a number within a defined range.
You can configure a Range input using the type
key with the value range
. Define the type
key under your input key name within _inputs
. You must also define the min
, max
, and step
options for this input to function.
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 Range input is called priority
.
The value of the type
key determines the input type. This is a range
Number input.
Unlike many other input types, some options must be defined for this input to work. The Range input requires min
, max
, and step
options.
All inputs are defined under the _inputs
key, regardless of where they are in the configuration cascade.
This Range input is called priority
.
The value of the type
key determines the input type. This is a range
Number input.
Unlike many other input types, some options must be defined for this input to work. The Range input requires min
, max
, and step
options.
Once configured, the Range 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 Number inputs using the options
key under your input key, inside of _inputs
.
Number inputs have the following options available:
This key determines the lowest numerical value permitted by this input. If you enter a value lower than this number, CloudCannon will highlight the input with a red border.
This key determines the highest numerical value permitted by this input. If you enter a value higher than this number, CloudCannon will highlight the input with a red border.
This key determines how granular changes to the value can be.
Value must be either:
- a number.
any
, which allows any decimal value betweenmax
andmin
values.
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 Number inputs#
In some cases, CloudCannon can still detect a Number input even if you have not configured it.
CloudCannon will interpret any unconfigured input with the key name number
, or that ends in _number
, as a Number input. Additionally, CloudCannon will interpret any unconfigured input with a numerical value as a Number input.
CloudCannon cannot detect unconfigured Range inputs as the min
, max
, and step
options are required for this input to function.
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#
Here are some examples of valid values for the key number
. These work for both Number and Range inputs.
Empty/null value:
number:
Whole base-10 integers (unquoted):
number: 123456
number: -123456
number: 123456e78
number: 123456e+78
number: 123456e-78
Floating point numbers (unquoted):
number: 123.456
number: -123.456
number: 123.456e78
number: 123.456e+78
number: 123.456e-78
Binary integers (unquoted):
number: 0b11110001001000000
Hexadecimal integers (unquoted):
number: 0x1E240
Whole base-10 integers (unquoted):
number = 12346
number = +123456
number = -123456
number = 123_456
Floating point numbers (unquoted):
number = 123.456
number = +123.456
number = -123.456
number = 123.456e78
number = 123.456E78
number = 123.456e09
number = 123.456e+78
number = 123.456e-78
number = -123.456e78
number = 123_456.789_012
Hexadecimal numbers (unquoted):
number = 0x1E240
Octal numbers (unquoted):
number = 0o361100
Hexadecimal numbers (unquoted):
number = 0b11110001001000000
Null value:
"number": null
Base-10 integers (unquoted):
"number": 123456
"number": -123456
"number": 123456e78
"number": -123456e78
Floating-point numbers (unquoted):
"number": 123.456
"number": -123.456
"number": 123.456e78
"number": 123.456E78
"number": 123.456e+78
"number": -123.456e78
When loaded in the Data Editor, binary and hexadecimal numbers will be converted to base-10 integers.