# useForm

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

Creates a reactive form store from a form configuration. The form store manages form state and provides reactive properties.

```ts
const form = useForm<TSchema>(config);
```

## Generics

- `TSchema` `extends FormSchema`

## Parameters

- `config` `FormConfig<TSchema>`

### Explanation

`useForm` creates a reactive form store that manages form state using the provided Valibot schema. Validation runs when the form is submitted by default, but this can be customized with the `validate` and `revalidate` options.

## Returns

- `form` `FormStore<TSchema>`

## Related

The following APIs can be combined with `useForm`.

### Hooks

[`useField`](/preact/api/useField.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), [`getDeepErrors`](/methods/api/getDeepErrors.md), [`getErrors`](/methods/api/getErrors.md), [`getInput`](/methods/api/getInput.md), [`handleSubmit`](/methods/api/handleSubmit.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), [`submit`](/methods/api/submit.md), [`swap`](/methods/api/swap.md), [`validate`](/methods/api/validate.md)
