Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/darrikonn/react-chloroform

A framework for building forms in React applications 📝
https://github.com/darrikonn/react-chloroform

form form-validation form-validation-react forms react validation

Last synced: 3 months ago
JSON representation

A framework for building forms in React applications 📝

Awesome Lists containing this project

README

        

# react-chloroform

---

[![NPM Version](https://img.shields.io/npm/v/react-chloroform.svg?style=flat)](https://www.npmjs.com/package/react-chloroform)
[![NPM Downloads](https://img.shields.io/npm/dt/react-chloroform.svg?style=flat)](https://npmcharts.com/compare/react-chloroform?minimal=true)
[![Build Status](https://img.shields.io/travis/darrikonn/react-chloroform.svg?style=flat)](https://travis-ci.org/darrikonn/react-chloroform)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![License](https://img.shields.io/github/license/darrikonn/react-chloroform.svg)](https://github.com/darrikonn/react-chloroform/blob/master/LICENSE)

## Why
> "No hooking up, super lightweight, and easy to use".

A form validation library with only `react` and `prop-types` as its dependency.

## Install
To install this package, run:
```
npm install --save react-chloroform
```

`yarn` users can use:
```
yarn add react-chloroform
```

You can also use the `UMD` build:
```

```

Or alternatively the `es5 commonjs` build:
```

```

## Examples
Refer to [`/examples`](https://github.com/darrikonn/react-chloroform/tree/master/examples) for all example source code.

### Quick start
```jsx
import React from 'react';
import {Form, FormInput, Button, ChloroformError} from 'react-chloroform';

const YourFormComponent = () => {
const handleSubmit = model => console.log(model);

const initialState = {
email: '[email protected]',
name: 'John Doe',
};

const isRequired = val => (val && val.length > 0) || 'This field is required';

return (


Email:

{error}

} />


Name:





);
};

export default YourFormComponent;
```

### Fiddles
- [`Example 1`](https://jsfiddle.net/darrikonn/gshkfp9v/)
- [`Example 2`](https://jsfiddle.net/darrikonn/61z0exLq/)

## API
Check out the [`api`](https://github.com/darrikonn/react-chloroform/blob/master/API.md).

## Contribution
React-Chloroform is open for contributions by the community.
Read the [`contributing guidelines`](https://github.com/darrikonn/react-chloroform/blob/master/CONTRIBUTING.md).

## Testing
```bash
npm install
```

Link from the react-chloroform git repo:

```bash
npm link
```

And then link from your test project with:
```bash
npm link react-chloroform
```

Build es with:
```bash
npm run build:es:watch
```

## License
MIT