Skip to content

Commit 825ccbf

Browse files
author
Kuldeep Saxena
authored
Update FormGenerator.md
1 parent 7619420 commit 825ccbf

File tree

1 file changed

+10
-26
lines changed

1 file changed

+10
-26
lines changed

docs/api/FormGenerator.md

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
# FormGenerator
3-
A react component which generates a new tree of control objects or can be used with an existing control tree & assign the components to the controls.
3+
A react component which generates a tree of control objects or can be append to an existing control tree & renders the associated React components in the same order.
44

55
## How it works
6-
- It creates a new instance of [FormControl](FormControl.md) if the `name` prop is defined.
7-
- If a `name` prop is defined then it means that the control has to be added in an already existing parent control ( [FormGroup](FormGroup.md) / [FormArray](FormArray.md)) i.e the parent control must be present.
8-
- If a control with the same name is already present in the parent control then it just returns the same otherwise it'll create a new instance of [FormControl](FormControl.md) class.
9-
- You can define a parent control either by passing the `parent` prop or using the component as a child of the `FieldArray` or `FieldGroup` component.
6+
- It creates a new instance of [FormGroup](FormGroup.md) ( if `controls` property is an object ) or [FormArray]
7+
(FormArray.md) ( if `controls` property is an array ).
8+
- It renders the UI of the form according to associated components to the controls by keeping the same order in which they have been defined in `fieldConfig`.
9+
- You can define a parent control by passing the `parent` property.
1010
- If a `control` prop is defined then it just returns the same.
1111

1212

@@ -91,7 +91,11 @@ formState: any|{ value: any, disabled: boolean }
9191
```
9292
You can use this prop to define the initial state of the control.
9393
##
94-
94+
```ts
95+
meta: {[key: string]: any};
96+
```
97+
##
98+
You can pass an object of custom variables to customize your component.
9599
```ts
96100
render: (control: FormArray|FormControl|FormGroup) => React.ReactElement<any>|React.ReactElement<any>[];
97101
```
@@ -105,12 +109,7 @@ control: AbstractControl;
105109
An instance of [AbstractControl](AbstractControl.md) control.
106110

107111
##
108-
```ts
109-
name: string;
110-
```
111-
Name of the control.
112112

113-
##
114113
```ts
115114
index: number
116115
```
@@ -128,20 +127,5 @@ parent: AbstractControl;
128127
```
129128
An instance of [FormGroup](FormGroup.md) or [FormArray](FormArray.md) class as a parent control.
130129

131-
##
132-
```ts
133-
meta: {[key: string]: any};
134-
```
135-
You can pass an object of custom variables to customize your component.
136130

137-
For example:
138131

139-
```ts
140-
<FieldControl
141-
meta={{
142-
label: "First Name",
143-
placeholder: "Enter your first name"
144-
}}
145-
...
146-
/>
147-
```

0 commit comments

Comments
 (0)