Skip to content

Commit 204aec9

Browse files
committed
Add constant page to schema section
1 parent bd25bb2 commit 204aec9

File tree

2 files changed

+105
-0
lines changed

2 files changed

+105
-0
lines changed

packages/react-renderer-demo/src/components/navigation/schemas/schema.schema.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const schemaNav = [
2424
component: 'data-types',
2525
linkText: 'Data types'
2626
},
27+
{
28+
component: 'constants',
29+
linkText: 'Constants'
30+
},
2731
{
2832
subHeader: true,
2933
title: 'Validation',
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import DocPage from '@docs/doc-page';
2+
3+
<DocPage>
4+
5+
# Constants
6+
7+
Data Driven Forms provides two constants files to keep consistency across all projects and prevent typos.
8+
9+
## componentTypes
10+
11+
Strings values used in `component` field attributes.
12+
13+
```jsx
14+
import { componentTypes } from '@data-driven-forms/react-form-renderer';
15+
16+
// or
17+
18+
import componentTypes from '@data-driven-forms/react-form-renderer/dist/cjs/component-types';
19+
20+
// or
21+
22+
import componentTypes from '@data-driven-forms/react-form-renderer/dist/esm/component-types';
23+
```
24+
25+
Available keys:
26+
27+
```jsx
28+
{
29+
TEXT_FIELD,
30+
FIELD_ARRAY,
31+
CHECKBOX,
32+
SUB_FORM,
33+
RADIO,
34+
TABS,
35+
DATE_PICKER,
36+
TIME_PICKER,
37+
WIZARD,
38+
SWITCH,
39+
TEXTAREA,
40+
SELECT,
41+
PLAIN_TEXT,
42+
SLIDER,
43+
DUAL_LIST_SELECT,
44+
BUTTON,
45+
INPUT_ADDON_GROUP,
46+
INPUT_ADDON_BUTTON_GROUP,
47+
}
48+
```
49+
50+
Usage:
51+
52+
```jsx
53+
{
54+
component: componentTypes.TEXT_FIELD,
55+
name: 'login'
56+
}
57+
```
58+
59+
## validatorTypes
60+
61+
Strings values used in `validate` [type attribute](/schema/introduction#validate).
62+
63+
```jsx
64+
import { validatorTypes } from '@data-driven-forms/react-form-renderer';
65+
66+
// or
67+
68+
import validatorTypes from '@data-driven-forms/react-form-renderer/dist/cjs/validator-types';
69+
70+
// or
71+
72+
import validatorTypes from '@data-driven-forms/react-form-renderer/dist/esm/validator-types';
73+
```
74+
75+
Available keys:
76+
77+
```jsx
78+
{
79+
REQUIRED,
80+
MIN_LENGTH,
81+
MAX_LENGTH,
82+
EXACT_LENGTH,
83+
MIN_ITEMS,
84+
MIN_NUMBER_VALUE,
85+
MAX_NUMBER_VALUE,
86+
PATTERN,
87+
URL,
88+
}
89+
```
90+
91+
Usage:
92+
93+
```jsx
94+
{
95+
component: componentTypes.TEXT_FIELD,
96+
name: 'login',
97+
validate: [{type: validatorTypes.REQUIRED}]
98+
}
99+
```
100+
101+
</DocPage>

0 commit comments

Comments
 (0)