Static CMS
Star StaticJsCMS/static-cms on GitHub
v4.3.0DocsExamplesDemoCommunity

Number

  • Name: number
  • UI: HTML number input
  • Data type: string or number. Configured by value_type option

The number widget uses an HTML number input, saving the value as a string, integer, or floating point number.

Widget Options

For common options, see Common widget options.

NameTypeDefaultDescription
defaultstring
| number
''Optional. The default value for the field. Accepts a string or number
value_type'int'
| 'float'
| 'string'
'string'Optional. Accepts int or float; any other value results in saving as a string
minnumberOptional. Minimum value accepted. If a pattern is provided (see Common widget options), min is ignored during validation, but is still applied to the input
maxnumberOptional. Maximum value accepted. If a pattern is provided (see Common widget options), max is ignored during validation, but is still applied to the input
stepnumber1Optional. Size of steps when stepping up or down in input
prefixstring''Optional. Text to show before number input
suffixstring''Optional. Text to show after number input

Example

name: 'puppies'
label: 'Puppy Count'
widget: 'number'
default: 2
value_type: 'int'
min: 1
max: 101
step: 2