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
Fixrjsf-team#4127 to add missing `Form` import in documentation
- Updated many of the documentation files to add missing imports of `Form`
- Updated the `CHANGELOG.md` accordingly
Copy file name to clipboardExpand all lines: packages/docs/docs/api-reference/form-props.md
+12-1
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,7 @@ You can provide custom buttons to your form via the `Form` component's `children
33
33
For other ways to modify the default `Submit` button, see both the [Submit Button Options](./uiSchema.md#submitbuttonoptions) and the [SubmitButton Template](../advanced-customization/custom-templates.md#submitbutton) documentation.
34
34
35
35
```tsx
36
+
import { Form } from'@rjsf/core';
36
37
import { RJSFSchema } from'@rjsf/utils';
37
38
importvalidatorfrom'@rjsf/validator-ajv8';
38
39
@@ -102,6 +103,7 @@ Optional enumerated flag controlling how empty object fields are populated, defa
102
103
|`skipEmptyDefaults`| Does not set an empty default. It will still apply the default value if a default property is defined in your schema |
103
104
104
105
```tsx
106
+
import { Form } from'@rjsf/core';
105
107
import { RJSFSchema } from'@rjsf/utils';
106
108
importvalidatorfrom'@rjsf/validator-ajv8';
107
109
@@ -133,6 +135,7 @@ Optional enumerated flag controlling how empty defaults are populated when `allO
133
135
|`populateDefaults`| Generate default values for properties in the `allOf` schema including `if-then-else` syntax |
134
136
135
137
```tsx
138
+
import { Form } from'@rjsf/core';
136
139
import { RJSFSchema } from'@rjsf/utils';
137
140
importvalidatorfrom'@rjsf/validator-ajv8';
138
141
@@ -190,6 +193,7 @@ render(
190
193
It's possible to disable the whole form by setting the `disabled` prop. The `disabled` prop is then forwarded down to each field of the form.
191
194
192
195
```tsx
196
+
import { Form } from'@rjsf/core';
193
197
import { RJSFSchema } from'@rjsf/utils';
194
198
importvalidatorfrom'@rjsf/validator-ajv8';
195
199
@@ -207,6 +211,7 @@ If you just want to disable some fields, see the `ui:disabled` parameter in `uiS
207
211
It's possible to make the whole form read-only by setting the `readonly` prop. The `readonly` prop is then forwarded down to each field of the form.
208
212
209
213
```tsx
214
+
import { Form } from'@rjsf/core';
210
215
import { RJSFSchema } from'@rjsf/utils';
211
216
importvalidatorfrom'@rjsf/validator-ajv8';
212
217
@@ -244,7 +249,9 @@ If set to true, then the first field with an error will receive the focus when t
244
249
You can also provide a custom callback function to handle what happens when this function is called.
Since the order of object properties in Javascript and JSON is not guaranteed, the `uiSchema` object spec allows you to define the order in which properties are rendered using the `ui:order` property:
Copy file name to clipboardExpand all lines: packages/docs/docs/usage/validation.md
+18
Original file line number
Diff line number
Diff line change
@@ -229,6 +229,7 @@ You can enable live form data validation by passing a `liveValidate` prop to the
229
229
Be warned that this is an expensive strategy, with possibly strong impact on performances.
230
230
231
231
```tsx
232
+
import { Form } from'@rjsf/core';
232
233
import { RJSFSchema } from'@rjsf/utils';
233
234
importvalidatorfrom'@rjsf/validator-ajv8';
234
235
@@ -251,6 +252,7 @@ If you have provided an `onError` callback it will be called with the list of er
251
252
252
253
```tsx
253
254
import { createRef } from'react';
255
+
import { Form } from'@rjsf/core';
254
256
import { RJSFSchema } from'@rjsf/utils';
255
257
importvalidatorfrom'@rjsf/validator-ajv8';
256
258
@@ -273,6 +275,7 @@ if (formRef.current.validateForm()) {
273
275
By default, the form uses HTML5 validation. This may cause unintuitive results because the HTML5 validation errors (such as when a field is `required`) may be displayed before the form is submitted, and thus these errors will display differently from the react-jsonschema-form validation errors. You can turn off HTML validation by setting the `noHtml5Validate` to `true`.
274
276
275
277
```tsx
278
+
import { Form } from'@rjsf/core';
276
279
import { RJSFSchema } from'@rjsf/utils';
277
280
importvalidatorfrom'@rjsf/validator-ajv8';
278
281
@@ -297,6 +300,7 @@ But it is possible to define your own custom validation rules that will run in a
297
300
This is especially useful when the validation depends on several interdependent fields.
298
301
299
302
```tsx
303
+
import { Form } from'@rjsf/core';
300
304
import { RJSFSchema } from'@rjsf/utils';
301
305
importvalidatorfrom'@rjsf/validator-ajv8';
302
306
@@ -331,6 +335,7 @@ Validation error messages are provided by the JSON Schema validation by default.
331
335
If you need to change these messages or make any other modifications to the errors from the JSON Schema validation, you can define a transform function that receives the list of JSON Schema errors and returns a new list.
332
336
333
337
```tsx
338
+
import { Form } from'@rjsf/core';
334
339
import { RJSFSchema } from'@rjsf/utils';
335
340
importvalidatorfrom'@rjsf/validator-ajv8';
336
341
@@ -379,6 +384,7 @@ This list is the form global error list that appears at the top of your forms.
379
384
An error list template is basically a React stateless component being passed errors as props, so you can render them as you like:
In this example `schema` passed as props to `Form` component can be validated against draft-07 (default) and by draft-04 (added), depending on the value of `$schema` attribute.
NOTE: This syntax works only for the `@rjsf/validator-ajv6` validator; if you only use the `draft-04` schema, and you want to use the `@rjsf/validator-ajv8` you can do the following:
@@ -526,6 +535,7 @@ Handling async errors is an important part of many applications. Support for thi
526
535
For example, a request could be made to some backend when the user submits the form. If that request fails, the errors returned by the backend should be formatted like in the following example.
If you don't actually need any of the [ajv-formats](https://github.com/ajv-validator/ajv-formats#formats) and want to reduce the memory footprint, then you can turn it off as follows:
0 commit comments