Skip to main content

betaThis is a new capability. Help us improve it and give your feedback on Slack.

Number Field

Numeric input for collecting whole or decimal numbers.

Preview

JSON definition

{
"type": "NumberField",
"name": "fieldName",
"title": "Question title",
"hint": "",
"shortDescription": "",
"options": {},
"schema": {}
}

Properties

PropertyTypeRequiredDescription
hintstringNoHint text displayed below the field label to help the user answer the question.
shortDescriptionstringNoA short description of the field used in the check-your-answers summary.

Options

PropertyTypeRequiredDescription
autocompletestringNoValue for the HTML autocomplete attribute (e.g. 'given-name', 'email').
classesstringNoAdditional CSS classes applied to the component.
conditionstringNoName of a condition that controls whether this component is shown.
customValidationMessagestringNoA single custom message shown for any validation error on this field.
customValidationMessagesobjectNoA map of Joi error codes to custom error messages.
instructionTextstringNoAlternative text read by screen readers in place of the field title.
optionalTextbooleanNoWhen true, appends '(optional)' to the field label.
prefixstringNoText displayed before the input (e.g. '£').
requiredbooleanNoWhether the field must be filled in. Defaults to true.
suffixstringNoText displayed after the input (e.g. 'kg').

Schema constraints

PropertyTypeDescription
maxnumberMaximum value, character length, word count, or file count.
minnumberMinimum value, character length, word count, or file count.
precisionnumberNumber of decimal places allowed.
minPrecisionnumberMinimum number of decimal places.
minLengthnumberMinimum number of characters.
maxLengthnumberMaximum number of characters.