# sandforms-react

> Simple, Flexible Forms for React

Latest version **1.0.4** (published 2020-02-02) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2020-02-02 |
| First published | 2018-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | L1lith |
| Maintainers | _lilith |
| Keywords | react, form |

## Links

- npm: https://www.npmjs.com/package/sandforms-react
- npm.io page: https://npm.io/package/sandforms-react

## Dependencies (3)

- [react](https://npm.io/package/react.md) ^16.4.2
- [auto-bind](https://npm.io/package/auto-bind.md) ^1.2.1
- [sandhands](https://npm.io/package/sandhands.md) ^1.5.0

## 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.4 (latest) — 2020-02-02
- 1.0.3 — 2020-02-02
- 1.0.25 — 2018-08-29
- 1.0.24 — 2018-08-29
- 1.0.22 — 2018-08-29
- 1.0.2 — 2018-08-29
- 1.0.19 — 2018-08-29
- 1.0.18 — 2018-08-28
- 1.0.17 — 2018-08-26
- 1.0.16 — 2018-08-26
- 1.0.15 — 2018-08-26
- 1.0.14 — 2018-08-26
- 1.0.135 — 2018-08-26
- 1.0.13 — 2018-08-26
- 1.0.12 — 2018-08-26
- … 3 more at https://npm.io/package/sandforms-react/versions

## README

# SandForms
SandForms makes working with forms a breeze.

#### Input Validation
SandForms uses [Sandhands](https://github.com/L1lith/Sandhands) to provide advanced input validation. To read more about the validation options see the [strings format](https://l1lith.github.io/Sandhands/format) in the Sandhands documentation.

### Compatability
Currently SandForms only supports react, however there are plans for vanilla JS support in the future.

## React
SandForms provides a Form component that will automatically detect string based input elements inside it and apply sanitation options (see the string options [here](https://l1lith.github.io/Sandhands/format)) to them based on the props passed to those elements. The form accepts a callback for receiving the submit event using the onSubmit prop. You can handle errors generated by the input validation using the form or inputs onError prop

#### Installation
```
npm i -s sandforms-react
```

#### Example Usage
```js
import {Form, Input} from 'sandforms-react'
import React from 'react'

class Login extends React.Component {
  submit({username, password}) {
    	console.log(`Got username "${username}", and password "${password}".`)
  }
  error(error){
  	console.log(`Got error "${error}"`)
  }
  render() {
    return (
      <Form onSubmit={this.submit} onError={this.error}>
      	<Input name="username" minLength={3} maxLength={25} regex={/^[a-zA_Z0-9]+$/}/>
        <Input name="password" type="password" minLength={8}/>
        <input type="submit"/>
      </Form>
    )
  }
}
export default Login
```

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