# useField

> This document is the Markdown version of [formisch.dev/preact/api/useField/](https://formisch.dev/preact/api/useField/). For the complete documentation index, see [llms.txt](https://formisch.dev/llms.txt).

Creates a reactive field store for a specific field within a form store.

```ts
const field = useField<TSchema, TFieldPath>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`
- `TFieldPath` `extends RequiredPath`

## Parameters

- `form` `FormStore<TSchema>`
- `config` `UseFieldConfig<TSchema, TFieldPath>`

### Explanation

With `useField` you create a reactive field store for a specific field path within your form. The field store provides reactive access to the field's input value, validation errors, touched state, and more. It also includes a `props` object that you can spread onto an HTML input or textarea element to automatically handle user interactions like focus, blur, and input events.

## Returns

- `field` `FieldStore<TSchema, TFieldPath>`

## Related

The following APIs can be combined with `useField`.

### Hooks

[`useForm`](/preact/api/useForm.md), [`useFieldArray`](/preact/api/useFieldArray.md)

### Components

[`Field`](/preact/api/Field.md), [`FieldArray`](/preact/api/FieldArray.md), [`Form`](/preact/api/Form.md)

### Methods

[`focus`](/methods/api/focus.md), [`getErrors`](/methods/api/getErrors.md), [`getInput`](/methods/api/getInput.md), [`setErrors`](/methods/api/setErrors.md), [`setInput`](/methods/api/setInput.md), [`validate`](/methods/api/validate.md)
