You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`autoConfig`|Boolean|`true`| Enables automatic configuration of required events for input validation. Recommended to keep as `true`. If set to `false`, you need to configure events manually. |
139
-
|`promptBaseColors`|Object|`{ "info": "#007bff", "warning": "#ffc107", "error": "#dc3545", "success": "#28a745" }`| Maps prompt types to colors shown in toast notifications for validation results (success, error, etc.). Define custom prompt types and colors. |
140
-
|`promptHoveredColors`|Object|`{ "info": "#0056b3", "warning": "#d39e00", "error": "#c82333", "success": "#218838" }`| Maps prompt types to colors shown when toast notifications are hovered over during validation. Define custom prompt types and colors. |
141
-
|`textAreaHighlightColors`|Object|`{ "info": "#007bff", "warning": "#ffc107", "error": "#dc3545", "success": "#28a745" }`| Maps prompt types to colors shown in the text area according to validation results. Define custom prompt types and colors. |
142
-
|`advancedStyles`|Object|`{}`| Customizes styles for different validation results across the chatbot (not just toast notifications). Each key is a prompt type with corresponding style properties. |
138
+
|`autoConfig`|boolean|`true`| Enables automatic configuration of required events for input validation. Recommended to keep as `true`. If set to `false`, you need to configure events manually. |
139
+
|`promptBaseColors`|object|`{ "info": "#007bff", "warning": "#ffc107", "error": "#dc3545", "success": "#28a745" }`| Maps prompt types to colors shown in toast notifications for validation results (success, error, etc.). Define custom prompt types and colors. |
140
+
|`promptHoveredColors`|object|`{ "info": "#0056b3", "warning": "#d39e00", "error": "#c82333", "success": "#218838" }`| Maps prompt types to colors shown when toast notifications are hovered over during validation. Define custom prompt types and colors. |
141
+
|`textAreaHighlightColors`|object|`{ "info": "#007bff", "warning": "#ffc107", "error": "#dc3545", "success": "#28a745" }`| Maps prompt types to colors shown in the text area according to validation results. Define custom prompt types and colors. |
142
+
|`advancedStyles`|object|`{}`| Customizes styles for different validation results across the chatbot (not just toast notifications). Each key is a prompt type with corresponding style properties. |
143
143
144
144
#### Validating User Input
145
145
@@ -175,15 +175,17 @@ const MyComponent = () => {
175
175
}
176
176
```
177
177
178
-
As you can see from the example above, `validateInput` takes in a `userInput` parameter and returns an object representing the validation result. The validation result contains a total of 5 fields described in the table below:
178
+
As you can see from the example above, `validateInput` takes in a `userInput` parameter and returns an object representing the validation result. The validation result contains a total of 5 properties described in the table below:
|`success`| Boolean | Yes | If `true`, validation passed and user input is allowed to be sent. If `false`, user input is blocked. |
183
-
|`promptContent`| String | No | The message displayed to the user if validation fails (e.g., "Age must be a number!"). |
184
-
|`promptDuration`| Number | No | The duration (in milliseconds) that the prompt message is shown. |
185
-
|`promptType`| String | No | Defines the type of prompt to display (e.g., "error", "warning", etc.), which influences styling and colors set in plugin configurations. |
186
-
|`highlightTextArea`| Boolean | No | If set to `true`, highlights the input text area according to validation result, providing more visual feedback. |
182
+
|`success`| boolean | false | If `true`, validation passed and user input is allowed to be sent. If `false`, user input is blocked. |
183
+
|`promptContent`| string | "" | The message displayed to the user if validation fails (e.g., "Age must be a number!"). |
184
+
|`promptDuration`| number | 3000 | The duration (in milliseconds) that the prompt message is shown. |
185
+
|`promptType`| string | "info" | Defines the type of prompt to display (e.g., "error", "warning", etc.), which influences styling and colors set in plugin configurations. |
186
+
|`highlightTextArea`| boolean | true | If set to `true`, highlights the input text area according to validation result, providing more visual feedback. |
187
+
188
+
Note that all above properties have default values assigned to them. This means that if the `validateInput` attribute does not return an expected object, validation fails by default since `success` would be `false`.
0 commit comments