# 📨 Forms

`@reins/forms` supports following features under the hood in fashion way:

1. Auto-Scroll to error on form submission
2. Multi-Stepped forms with super cool validation handling between steps
3. `FormPage` component to help with multi-stepping rendering conditions in remarkable way.
4. Support such libraries for validation like `zod`, `yup`, `joi` and `native callback` with async handling
5. Single\Multi errors and validators for field handling
6. TS-guard for `type` prop in `Field` depending on what type is the field value
7. TS-guard for `name` prop in `Field` via `factory pattern` used for our form creation
8. `Dependency Validation` - feature allows us to validate one field depending on another field(-s) // Note: need checks
   once `onChangeValidate` & `onBlurValidate` will be added

TODO-list to master our forms:

1. FormData support
2. Array handling support
3. Implement `isDirty`, `isValid` and `onChangeValidate` with `onBlurValidate`. And polish `Dependency Validation`
4. Implement Form `isLoading` & `isDisabled` global props --- ???
5. Add `GlobalChange` callback --- ???
6. Platform supported validation, inspired by https://www.react-hook-form.com/get-started/#Registerfields

```tsx
import { createForm } from "@reins/forms";
```

# Form additional control

- more control
- better ts integration
- easier handling

# Multi-step-forms

- support for multi step out of the box

# Components logic

- better communication with forms

# Hooks

## useInitialData

- fetch initial data if patch, use constant data if post

## useAutocomplete

- dynamic data fetching for selects

## useSubmitForm

- integrated logic for the form submitting
