# react-formsio

> Made with create-react-library

Latest version **1.0.2** (published 2020-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-formsio
pnpm add react-formsio
yarn add react-formsio
bun add react-formsio
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-09-20 |
| First published | 2020-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 142.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | itzzmeakhi |
| Maintainers | itzzmeakhi |
| Keywords | react, reactjs, forms, form-validation, validation, react-formsio, formsio, useFormsio |

## Links

- npm: https://www.npmjs.com/package/react-formsio
- Repository: https://github.com/itzzmeakhi/react-formsio
- Homepage: https://github.com/itzzmeakhi/react-formsio#readme
- Issues: https://github.com/itzzmeakhi/react-formsio/issues
- npm.io page: https://npm.io/package/react-formsio

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2020-09-20
- 1.0.1 — 2020-09-18

## README

# react-formsio

[![npm](https://img.shields.io/npm/v/react-formsio)](https://www.npmjs.com/package/react-formsio)   [![GitHub issues](https://img.shields.io/github/issues/itzzmeakhi/react-formsio)](https://github.com/itzzmeakhi/react-formsio/issues) ![npm](https://img.shields.io/npm/dt/react-formsio) ![GitHub contributors](https://img.shields.io/github/contributors/itzzmeakhi/react-formsio) [![GitHub last commit](https://img.shields.io/github/last-commit/itzzmeakhi/react-formsio)](https://github.com/itzzmeakhi/react-formsio) [![Twitter Follow](https://img.shields.io/twitter/follow/itzzmeakhi?style=social)](https://twitter.com/itzzmeakhi)


Easy to use, and light weight library for form validations in React.

## Motivation 💪

Before jumping to React, I was an Angular Developer. While I was learning React, I was like, "Oh!  Angular kind of validating forms is missing in React", and the result is this library.

## What you can do 🧐

1) Instead of importing a wrapper component for each field, add validations to the traditional HTML fields itself.
2) Basic validators like `required`, `email`, `maxLength`, `minLength`, and `pattern` can be applied.
3) In addition to the basic validators, some most used validators like `validMobile`, `validBirthDate`, and `passwordStrength` with customization are applied.
4) Changes uncontrolled inputs to controlled inputs internally, no need for explicitly chaining an `onchange` event. 
5) Pass validation errors to the form to invalidate individual fields.

## Installation 💻 
```
npm install react-formsio --save
```

## Usage 👨‍💻

### Adding Validation to the HTML text field!
```jsx
import React from 'react';
import './App.css';

import { useFormsio } from 'react-formsio';

const App = () => {
  const { register, 
	  formState, 
	  validationRules, 
	  isFormValid } = useFormsio();
  const { userName } = formState;
	
  const handleSubmit = event => {
    event.preventDefault();
  }
  
  return(
    <div className = 'App'>
      <form onSubmit = {handleSubmit} >
        <input
	  type = 'text'
	  name = 'userName'
	  ref = { register({
	          validators: 'required|minLength:6'
		}) }
	  autoComplete = 'off' />
	  
	{ userName?.errors?.required ? 
	    <p> UserName is required </p> : null }
	{ userName?.errors?.minLength ? 
	    <p> UserName should be of minimum 6 character's length </p> : null }

	<button type = 'submit'> Submit </button>
      </form>
    </div>
  )
}

export default App;
```

## Example & Demo 🧩


[![React Formsio Demo GIF](images/react-formsio-demo.gif)](https://react-formsio.stackblitz.io)

### [Stackblitz Link](https://stackblitz.com/edit/react-formsio?file=src/App.js)
### [Live Demo](https://react-formsio.stackblitz.io)


## More 📖 

See the [API/Tutorial](/API.md) for more information.

## Bug / Feature Request 📣

If you find a bug or you'd like to request a new function, kindly open an issue [here](https://github.com/itzzmeakhi/react-formsio/issues/new). Please include your queries and their expected results.


## License ©️

MIT © [itzzmeakhi](https://github.com/itzzmeakhi)

---
_Source: https://npm.io/package/react-formsio · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
