Open History to see the last commit
1---
2id: FieldGroupFieldComponent
3title: FieldGroupFieldComponent
4---
5β
6Defined in: [packages/react-form/src/FieldGroup/FieldGroupApi.public.ts:20](https://github.com/TanStack/form/blob/main/packages/react-form/src/FieldGroup/FieldGroupApi.public.ts#L20)
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
19FieldGroupFieldComponent<TFieldName>(props): ReactNode;
20```
21β
22Defined in: [packages/react-form/src/FieldGroup/FieldGroupApi.public.ts:67](https://github.com/TanStack/form/blob/main/packages/react-form/src/FieldGroup/FieldGroupApi.public.ts#L67)
23β
24Renders a 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* `string`
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 passwordFieldGroup = defineFieldGroup(({ strict }) => ({
49 password: strict<string>(),
50 confirmPassword: strict<string>(),
51}))
52β
53interface PasswordFieldsProps {
54 fields: typeof passwordFieldGroup.fields
55}
56β
57function PasswordFields({ fields }: PasswordFieldsProps) {
58 return (
59 <>
60 <fields.Field name="password">
61 {(field) => (
62 <input
63 type="password"
64 value={field.value}
65 onChange={(event) => field.handleChange(event.target.value)}
66 />
67 )}
68 </fields.Field>
69 <fields.Field name="confirmPassword">
70 {(field) => (
71 <input
72 type="password"
73 value={field.value}
74 onChange={(event) => field.handleChange(event.target.value)}
75 />
76 )}
77 </fields.Field>
78 </>
79 )
80}
81```