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
Copy file name to clipboardExpand all lines: packages/form/README.md
+24-17Lines changed: 24 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,40 +63,47 @@ export default {
63
63
64
64
The form expects a JSON schema of 2020-12 version. The schema is used to generate and validate the form.
65
65
66
-
Some additional keywords are allowed that are used specialize the form generation.
66
+
Some additional keywords can be used to specialize the form generation.
67
67
68
68
### symbol keyword
69
69
70
70
The form label uses the value of the `title` key or property key.
71
-
If you want an even shorter label you can add the `symbol` key with a string value.
71
+
If you want an shorter label you can add the `symbol` key with a string value.
72
72
An example value could be `β` for beta.
73
73
When symbol is set the title will be displayed as a tooltip.
74
74
75
75
### unit keyword
76
76
77
-
A property can have a `unit` key with a string value. The value can for example
78
-
`kg kg-1`. The unit will be displayed in the form.
77
+
A property can have a `unit` key with a string value.
78
+
An example value could be `kg kg-1`.
79
+
The unit will be displayed in the form.
79
80
80
81
### ui:group keyword
81
82
82
83
The JSON schema must be flat, due to its use for form generation. There can not be a nested object in the schema.
83
-
In the form generation use the `ui:group` key and any string value to group properties together.
84
-
The group name will be displayed as a header in the form. The `ui:group` value should not be used across different `then` blocks.
84
+
During the form generation, the `ui:group` key and its string value are used to group properties together.
85
+
The group name will be displayed as a header in the form.
86
+
The `ui:group` value should be the same for the properties in a `if` and `then` block.
85
87
86
88
### ui:widget keyword
87
89
88
-
Some property you would like to have a different input widget for. This widget can be chosen by setting the `ui:widget` key to a string value. Valid values are
90
+
Some property you would like to have a different input widget for.
91
+
This widget can be chosen by setting the `ui:widget` key to a string value.
92
+
Valid values are
89
93
90
-
-`textarea` for a text area input
94
+
-`textarea` for a text area input. Given property type is `string`.
91
95
92
96
### Supported types
93
97
94
-
The form generation can handle the following types:
98
+
The form generation can handle the following property types:
95
99
96
100
- string
101
+
- rendered as text input or
102
+
- if has enum values then rendered as radio group
97
103
- number
98
-
- boolean
99
-
- array of numbers: The form will display a text input that can be filled with a comma separated list of numbers.
104
+
- integer
105
+
- boolean: rendered as checkbox
106
+
- array of numbers: rendered as text input that can be filled with a comma separated list of numbers
100
107
101
108
## API
102
109
@@ -107,20 +114,20 @@ Properties of Form component:
107
114
-`schema` - The JSON schema for the form. Must be version 2020-12.
108
115
-`values` - Initial values for the form fields.
109
116
-`onSubmit` - Callback function to handle form submission. Called with the form values.
110
-
-`defaults` - Default values to overwrite in the schema.
111
-
-`id` - The id of the form element. Can be used to submit form from a non-child element.
112
-
-`children` - Child elements to render inside the form. Mostly used for submit button.
113
-
-`uiComponents` - Custom UI components to use in the form.
117
+
-`defaults` - Default values to overwrite in the schema. Optional.
118
+
-`id` - The id of the form element. Can be used to submit form from a non-child element. Optional.
119
+
-`children` - Child elements to render inside the form. Mostly used for submit button. Optional.
120
+
-`uiComponents` - Custom UI components to use in the form. Optional.
114
121
115
122
The values, defaults and onSubmit argument are the same type.
116
123
117
124
## Development
118
125
119
-
To use in a monorepo as a dependency this package needs to be built first with
126
+
To use this package in this monorepo, the package needs to be built first with
0 commit comments