Open History to see the last commit
1---
2id: FieldGroupArrayFieldComponent
3title: FieldGroupArrayFieldComponent
4---
5β
6Defined in: [packages/react-form/src/FieldGroup/FieldGroupApi.public.ts:85](https://github.com/TanStack/form/blob/main/packages/react-form/src/FieldGroup/FieldGroupApi.public.ts#L85)
7β
8## Type Parameters
9β
10### TFieldData
11β
12`TFieldData`
13β
14### TFieldComponents
15β
16`TFieldComponents` *extends* [`ReactComponentTree`](../type-aliases/ReactComponentTree.md)
17β
18```ts
19FieldGroupArrayFieldComponent<TFieldName>(props): ReactNode;
20```
21β
22Defined in: [packages/react-form/src/FieldGroup/FieldGroupApi.public.ts:129](https://github.com/TanStack/form/blob/main/packages/react-form/src/FieldGroup/FieldGroupApi.public.ts#L129)
23β
24Renders an array field from this field group.
25β
26The field name is automatically connected to the form section where the
27field group is used.
28β
29## Type Parameters
30β
31### TFieldName
32β
33`TFieldName` *extends* `never`
34β
35## Parameters
36β
37### props
38β
39[`ReactFormFieldProps`](ReactFormFieldProps.md)\<`TFieldData`, `TFieldName`, `DeepValue`\<`TFieldData`, `TFieldName`\>, `FieldValidators`\<`TFieldData`, `TFieldName`, `DeepValue`\<`TFieldData`, `TFieldName`\>\>, `ValidationIssue`, `unknown`, `FormErrorTypes`\<`ValidationIssue`, `ValidationIssue`\>, `TFieldComponents`\>
40β
41## Returns
42β
43`ReactNode`
44β
45## Example
46β
47```tsx
48const contactFieldGroup = defineFieldGroup(({ strict }) => ({
49 emails: strict<Array<{ value: string }>>(),
50}))
51β
52interface ContactFieldsProps {
53 fields: typeof contactFieldGroup.fields
54}
55β
56function ContactFields({ fields }: ContactFieldsProps) {
57 return (
58 <fields.ArrayField name="emails">
59 {(emails) => (
60 <>
61 {emails.value.map((_, index) => (
62 <fields.Field key={index} name={`emails[${index}].value`}>
63 {(field) => (
64 <input
65 value={field.value}
66 onChange={(event) =>
67 field.handleChange(event.target.value)
68 }
69 />
70 )}
71 </fields.Field>
72 ))}
73 </>
74 )}
75 </fields.ArrayField>
76 )
77}
78```