Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eureka-shoulders/formix

A Formik inspired form library that uses MobX under the hood
https://github.com/eureka-shoulders/formix

form mobx react

Last synced: 2 months ago
JSON representation

A Formik inspired form library that uses MobX under the hood

Awesome Lists containing this project

README

        

# Formix

![npm](https://img.shields.io/npm/v/@euk-labs/formix)
![NPM](https://img.shields.io/npm/l/@euk-labs/formix)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/Eureka-Shoulders/formix/CI)
![npm](https://img.shields.io/npm/dw/@euk-labs/formix)

A Formik inspired form library that uses MobX under the hood and update only the changed fields.

## Installation

Using npm:

```bash
npm install @euk-labs/formix mobx mobx-react-lite
```

Using yarn:

```bash
yarn add @euk-labs/formix mobx mobx-react-lite
```

## Example

### Creating your first input

```tsx
import { useField } from '@euk-labs/formix';
import { observer } from 'mobx-react-lite'
import { InputHTMLAttributes } from 'react';

function TextField(
props: InputHTMLAttributes & { name: string }
) {
const { name, ...rest } = props;
const { field } = useField(name);

return ;
}

export default observer(TextField)
```

### Creating your first form

```tsx
import { Formix } from '@euk-labs/formix';
import { TextField } from './TextField';

const initialValues = {
firstName: '',
lastName: '',
email: '',
password: '',
};

function handleSubmit(values) {
console.log(values);
}

function Form() {
return (




Submit

);
}
```