Pattern format
Introduction
Pattern format represents a component that is used for formatting and displaying numbers and numeric values according to your specified pattern. This component is a part of @react-form-builder/components-rsuite.
Pattern format is used to format numeric values, such as phone numbers, credit card numbers, or other types of numeric data. It takes a provided value as input and returns a formatted string that matches your provided configuration.
By leveraging provided options and properties, you can create a customized format component that meets your specific use case and enhances your form.
Main properties
The properties located within the Main tab. These allow you to provide general format configuration:
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 | Disables the component |
Read Only | boolean | Makes the component read-only |
Format | string | Defines the format pattern using the # (or a Pattern char ) character. # is the placeholder character for numbers |
Mask | string | Use this to specify a mask character for each numeric position. The mask character will be displayed until a numeric character is entered. You can use different mask characters for each position by providing an array of mask characters. Important: Make sure the number of mask characters matches the number of pattern characters |
Pattern char | string | Helps define the format pattern character; i.e., replace # |
Allow empty formatting | boolean | By default, PatternFormat component does not apply formatting when value is empty (null , undefined or empty string). If you want to apply formatting on empty values, set this to true |
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