1
1
import Grid from '@material-ui/core /Grid'
2
- import RawComponent from '@ docs/raw-component ';
2
+ import CodeExample from '../../src/components/code-example ';
3
3
4
4
import ListOfContents from '../../src/helpers/list-of-contents';
5
5
@@ -16,29 +16,29 @@ A item of the validate array can be:
16
16
17
17
## Required validator
18
18
19
- <RawComponent source =" validators/required-validator " />
19
+ <CodeExample source =" components/ validators/required-validator" mode = " preview " />
20
20
21
21
## Length validators
22
22
23
- <RawComponent source =" validators/length-validators " />
23
+ <CodeExample mode = " preview " source = " components/ validators/length-validators" />
24
24
25
25
## Number value validators
26
26
27
- <RawComponent source =" validators/number-validator " />
27
+ <CodeExample mode = " preview " source = " components/ validators/number-validator" />
28
28
29
29
## Pattern validators
30
30
31
- <RawComponent source =" validators/pattern-validator " />
31
+ <CodeExample mode = " preview " source = " components/ validators/pattern-validator" />
32
32
33
33
## URL validators
34
34
35
- <RawComponent source =" validators/url-validator " />
35
+ <CodeExample mode = " preview " source = " components/ validators/url-validator" />
36
36
37
37
## Custom function
38
38
39
39
As validator you can provide your custom function:
40
40
41
- <RawComponent source =" validators/custom-function " />
41
+ <CodeExample mode = " preview " source = " components/ validators/custom-function" />
42
42
43
43
The function takes ` value ` as an argument and should return undefined when pasess or string as an error message when fails.
44
44
@@ -48,7 +48,7 @@ You can use a Async function as a validator. But it **must be first in the valid
48
48
49
49
You can either use custom function, or custom validator from validator mapper.
50
50
51
- <RawComponent source =" validators/async-validator " />
51
+ <CodeExample mode = " preview " source = " components/ validators/async-validator" />
52
52
53
53
54
54
Validator inputs and results are being cached so you will get immediate feedback for recurring values before the validation is actually finished.
@@ -130,13 +130,13 @@ By providing `validateOnMount` the validation will be triggered immediately afte
130
130
This form of validation enables you to create validation function for whole form. It is useful for some cross validation between multiple fields etc.
131
131
Detailed information can be found [ here] ( https://final-form.org/docs/react-final-form/examples/record-level-validation ) .
132
132
133
- <RawComponent source =" validators/record-level-validation " />
133
+ <CodeExample mode = " preview " source = " components/ validators/record-level-validation" />
134
134
135
135
# Overwriting default messages
136
136
137
137
You can either specify message attribute while adding validator or override validation message of specific validator globally via Validators config.
138
138
139
- <RawComponent source =" validators/global-message " />
139
+ <CodeExample mode = " preview " source = " components/ validators/global-message" />
140
140
141
141
</Grid >
142
142
<Grid item xs ={false} md ={2} >
0 commit comments