Number format
Introduction
Number format is a powerful input formatter that allows you to restrict and format user input to specific numeric or string patterns. This component is a part of @react-form-builder/components-rsuite.
This component is used to format the input value for display, making it easier to work with and ensuring that users can only enter text valid for your specific use case. It also offers a range of features to help you control and customize user input. These include prefix, suffix, decimal and thousands separators, scales, and more.
Additionally, the component is fully customizable, allowing you to tailor its behavior and appearance to meet your specific needs. The following introduces and describes available properties for this component.
Main properties
The following general properties are available within the Main tab:
Name | Type | Description |
---|---|---|
Label | string | Provide a name for your input field |
Value | string | Enter default value for the input field |
Placeholder | string | Specify placeholder for the input field. Will not visible if a Value is provided |
Size | choice | Select the component size from extra small to large |
Disabled | boolean | If set to true, disables the component |
Read Only | boolean | If set to true, makes the component unavailable for users to interact with |
Allowed decimal separators | string | Specifies the characters that can be used as decimal separators. Defaults to "." if left empty |
Allow leading zeroes | boolean | If set to true, allows the presence of leading zeroes in the input; otherwise, all leading zeroes are removed |
Allow negative | boolean | If set to true, allows the input of negative values by prefixing them with a minus sign ("-"); otherwise, only positive values are allowed |
Decimal scale | number | The number of decimal places to display and accept in the input value. For example, a decimal scale of "2" would allow up to two decimal places |
Decimal separator | string | Specifies the character used to separate the integer and fractional parts of a number |
Fixed decimal scale | boolean | If set to true, trailing zeroes will be added after decimal separators to match the specified decimal scale |
Prefix | string | Prepends given prefix character to the input value, can be used to provide measurement unit or any other prefix |
Suffix | string | Appends given suffix character to the input value, can be used to provide currency symbol or any other suffix |
Thousands group style | choice | Specifies the style for grouping thousands, such as thousand (e.g., 123,456,789), indian lakh (e.g., 12,34,56,789), chinese wan (e.g., 1,2345,6789), or none (no grouping) |
Thousand Separator | string | Specifies the character used to separate groups of thousands, such as a comma, a dot, etc. |
At the bottom of the Main properties menu, you can find additional options:
- Render When: Provides conditional rendering for your calendar as described in the corresponding chapter.
- HTML attributes: Allows you to provide custom HTML attributes for your form.
Style properties
These are properties that allow to customize the size, color and other style properties of your component:
- For Device: You can provide component's style customization for all devices or specific devices by using this dropdown list. Refer to Adaptive Layout for more details.
- Component > Class Name: Add a class name for your component for the subsequent styling if necessary.
-
Wrapper: The options below enable you to tailor the appearance of your component and customize it for a specific device type, as selected in the For Device property:
Name Type Description Width number
Specifies the width for your component Height number
Specifies the height for your component Margin top/right/bottom/left number
Margin values for you component Color string
Allows customizing the text color Background color string
Enables customizing the background color