Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

Field.md

38 lines1.0 KB

1---
2id: Field
3title: Field
4---
5​
6# Function: Field()
7​
8```ts
9function Field<TParentData, TName, TFieldValidator, TFormValidator, TData>(__namedParameters): ReactNode
10```
11​
12A function component that takes field options and a render function as children and returns a React component.
13​
14The `Field` component uses the `useField` hook internally to manage the field instance.
15​
16## Type Parameters
17​
18β€’ **TParentData**
19​
20β€’ **TName** *extends* `string` \| `number`
21​
22β€’ **TFieldValidator** *extends* `undefined` \| `Validator`\<`DeepValue`\<`TParentData`, `TName`\>, `unknown`\> = `undefined`
23​
24β€’ **TFormValidator** *extends* `undefined` \| `Validator`\<`TParentData`, `unknown`\> = `undefined`
25​
26β€’ **TData** = `DeepValue`\<`TParentData`, `TName`\>
27​
28## Parameters
29​
30β€’ **\_\_namedParameters**: `FieldComponentProps`\<`TParentData`, `TName`, `TFieldValidator`, `TFormValidator`, `TData`\>
31​
32## Returns
33​
34`ReactNode`
35​
36## Defined in
37​
38[useField.tsx:163](https://github.com/TanStack/form/blob/a6313b7699753752ae30ff16c169e0b08c2369e8/packages/react-form/src/useField.tsx#L163)