Widget number

Widget number

The number widget displays a locale specific number. This is mainly useful for currency values.

The formData value that can be handled by this widget must be a JSON number.

Important: The type of the schema property definition must be string, not number.

Options

  • decimals: An integer number that defines the number decimal digits. Optional, default value is 2.

Example

{
    "schema": {
        "properties": {
            "myNumberProperty": {
                "type": "string"
            }
        }
    },
    "form": [
        "myNumberProperty"
    ],
    "uiSchema": {
        "myNumberProperty": {
            "widget": "number",
            "digits": 2
        }
    },
    "formData": {
        "myNumberProperty": 1234.56
    }
}

This will render a text input field that formats an entered number using two decimal digits. The exact render format (thousands and decimal separator) depends on the locale of the client.