Number
Any number, e.g. 900
, 900.0
, 9E+2
 or 9.0E+2
.
Properties
REQUIREDtypestring
Value must be set to
number
.REQUIREDnamestring
Required. The field name. This will be the key in the data record.
titlestring
Human readable label for the field.
boolean | function
If set toÂ
true
, this field will be hidden in the studio. You can also return a callback function to use it as a conditional field.readOnlyboolean | function
If set toÂ
true
, this field will not be editable in the content studio. You can also return a callback function to use it as a conditional field.descriptionstring
Short description to editors how the field is to be used.
initialValue
The initial value used when creating new values from this type. Can be either a literal number value or a resolver function that returns either a literal number value or a promise resolving to a number value.
componentsobject
Lets you provide custom components to override the studio defaults in various contexts. The components available are
field
,input
,item
,preview
.
Options
listarray
A list of predefined values that the user may pick from. The array can include numeric valuesÂ
[1, 2]
 or objectsÂ[{value: 1, title: 'One'}, ...]
.layoutstring
Controls how the items defined in theÂ
list
 option are presented. If set toÂ'radio'
 the list will render radio buttons. If set toÂ'dropdown'
 you'll get a dropdown menu instead. Default isÂdropdown
.directionstring
Controls how radio buttons are lined up. Use
direction: 'horizontal|vertical'
to render radio buttons in a row or a column. Default isvertical
. Will only take effect if thelayout
option is set toradio
.
Validation
Learn more about validationrequired()function
Ensures that this field exists.
min(minNumber)function
Minimum value (inclusive).
max(maxNumber)function
Maximum value (inclusive).
lessThan(limit)function
Value must be less than the given limit.
greaterThan(limit)function
Value must be greater than the given limit.
integer()function
Value must be an integer (no decimals).
precision(limit)function
Specifies the maximum number of decimal places allowed.
positive()function
Requires the number to be positive (>= 0).
negative()function
Requires the number to be negative (< 0).
custom(fn)function
Create a custom validation.
Input
{
title: 'Current popularity',
name: 'popularity',
type: 'number'
}
Output
{
"_type": "movie",
"popularity": 12.5,
...
}
Gotcha
Never use number
 for storing a phone-number. Minimize pain down the road and use string
instead.