# simply-react-forms

> Add Serverless forms to your React Application

Latest version **0.0.9** (published 2020-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install simply-react-forms
pnpm add simply-react-forms
yarn add simply-react-forms
bun add simply-react-forms
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2020-10-31 |
| First published | 2020-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 63.7 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Simply Development |
| Maintainers | schorts99 |

## Links

- npm: https://www.npmjs.com/package/simply-react-forms
- Repository: https://github.com/Simply-Development/React-Forms
- Homepage: https://github.com/Simply-Development/React-Forms#readme
- Issues: https://github.com/Simply-Development/React-Forms/issues
- npm.io page: https://npm.io/package/simply-react-forms

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2
- [react-toastify](https://npm.io/package/react-toastify.md) ^6.0.9

## Recent versions

- 0.0.9 (latest) — 2020-10-31
- 0.0.8 — 2020-10-27
- 0.0.7 — 2020-10-27
- 0.0.6 — 2020-10-26
- 0.0.5 — 2020-10-26
- 0.0.4 — 2020-10-26
- 0.0.3 — 2020-10-26
- 0.0.2 — 2020-10-26
- 0.0.1 — 2020-10-25

## README

# simply-react-forms

> Add Serverless forms to your React Application

[![NPM](https://img.shields.io/npm/v/simply-react-forms.svg)](https://www.npmjs.com/package/simply-react-forms) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

This library needs the tailwindcss stylesheet and react toastity to work

```bash
npm install --save simply-react-forms tailwindcss react-toastify
```

## Usage

1. You'll need to register to [Simply Forms](https://forms.simply-development).
2. Verify your email to create a project.
3. Inside the project you want, create a form. Here is we're you define the validations which is going to be required at client an server before the response of the form creates.
4. Download your config file which is required by Form Component.
5. 🎉 Enjoy!

```js
import { Form } from 'simply-react-forms'
import 'tailwindcss/dist/tailwind.min.css';
import 'react-toastify/dist/ReactToastify.css'
import { ToastContainer } from 'react-toastify'
import formConfig from './contact-form-config.json'

export default function App() {
  return (
    <>
      <Form {...formConfig} />
      <ToastContainer />
    </>
  )
}
```

## Components

By now there's only one single Component which is a basic implementation for Simply Forms, if you wan't to contribute this project, feel free to do it, I'll appreciate it so much.

### Form

This allow you to create a whole form (including validations) only passing a basic form config file (or passing all props required) and personalizing it.

```js
import { Form } from 'simply-react-forms'
import 'tailwindcss/dist/tailwind.min.css';
import 'react-toastify/dist/ReactToastify.css'
import { ToastContainer } from 'react-toastify'
import formConfig from './contact-form-config.json'

export default function App() {
  return (
    <>
      <Form
        {...formConfig}
        title="Contact Us"
        message="Tell Us how We can help You"
        labels={{
          name: 'Name',
          message: 'Message'
        }}
        placeholders={{
          name: 'Elon Musk',
          message: 'Your problem here...'
        }}
        onCompleted={data => console.log(data)}
        onError={error => console.error(error)}
        button={{
          label: 'Send'
        }}
      />
      <ToastContainer />
    </>
  )
}
```

#### Properties

| Name | Type | Description |
| - | - | - |
| projectID | String | ID from the project, you can find this in your project config at [Simply Forms](https://forms.simply-development) |
| formID | String | ID from the form, same as projectID, you can find it in your form config at [Simply Forms](https://forms.simply-development) |
| title | String | Display a simple title for your form |
| message | String | Be descriptive about what is the goal of respond to your form. Default: undefined |
| fields | Array | This is an array of objects with the configuration of every input which is going to be rendered on the form |
| labels | Object | Here you can set the input labels, by example: if You have a name field, the you have to pass a key name with the label as value. Default: {} |
| placeholders | Object | Same as labels. Default: {} |
| onCompleted | Func | This function will be called if the response is created successfully. Default: () => {} |
| onError | Func | And this function will be called if there's an error on response creation. Default: () => {} |
| errors | Object | By now, you can only set a general error for a field, so this works same as labels or placeholders. Default: {} |
| colors | Object | Here you can set the color of the title, message and label. Default: undefined |
| input | Object | Here you cant personalize the Input component like the background, color, border. Default: {} |

## License

MIT © [Simply-Development](https://github.com/Simply-Development)

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