Skip to content

float ​

float fields support number input with decimals (floating point numbers). You may set minimum and maximum values using the min and max options.

Module field definition ​

javascript
// Configuring the `gpa` field in a module's `fields.add` subsection:
gpa: {
  label: 'What was your grade point average (GPA)?',
  type: 'float',
  min: 1.0,
  max: 4.5
}

Settings ​

Required ​

PropertyTypeDefaultDescription
labelStringn/aSets the visible label for the field in the UI
typeStringn/aSpecifies the field type (float for this type)

Optional ​

PropertyTypeDefaultDescription
defNumbern/aThe default value for the field
directionString'ltr'Sets the text direction for the field. Use 'ltr' for left-to-right or 'rtl' for right-to-left. Overrides the locale's default direction. See the RTL language support guide for details.
helpStringn/aHelp text for the content editor
htmlHelpStringn/aHelp text with support for HTML markup
ifObject{}Conditions to meet before the field is active. See the guide for details.
requiredIfObject{}Conditions to meet before the field is required. See the guide for details.
hiddenBooleanfalseIf true, the field is hidden
maxNumbern/aThe maximum allowed value for the field
minNumbern/aThe minimum allowed value for the field
requiredBooleanfalseIf true, the field is mandatory
readOnlyBooleanfalseIf true, prevents the user from editing the field value

Use in templates ​

jsx
GPA: {piece.gpa}