# useFieldArray

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

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

```ts
const fieldArray = useFieldArray<TSchema, TFieldArrayPath>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`
- `TFieldArrayPath` `extends RequiredPath`

## Parameters

- `form` `MaybeGetter<FormStore<TSchema>>`
- `config` `MaybeGetter<UseFieldArrayConfig<TSchema, TFieldArrayPath>>`

### Explanation

With `useFieldArray` you create a reactive field array store for a specific array field within your form. The field array store provides reactive access to the array items (by their IDs), validation errors, touched state, and more. This is particularly useful when working with dynamic arrays of fields that users can add or remove.

## Returns

- `fieldArray` `FieldArrayStore<TSchema, TFieldArrayPath>`

## Related

The following APIs can be combined with `useFieldArray`.

### Runes

[`createForm`](/svelte/api/createForm.md), [`useField`](/svelte/api/useField.md)

### Components

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

### Methods

[`focus`](/methods/api/focus.md), [`getDeepErrors`](/methods/api/getDeepErrors.md), [`getErrors`](/methods/api/getErrors.md), [`getInput`](/methods/api/getInput.md), [`insert`](/methods/api/insert.md), [`move`](/methods/api/move.md), [`remove`](/methods/api/remove.md), [`replace`](/methods/api/replace.md), [`reset`](/methods/api/reset.md), [`setErrors`](/methods/api/setErrors.md), [`setInput`](/methods/api/setInput.md), [`swap`](/methods/api/swap.md), [`validate`](/methods/api/validate.md)
