# formunition

> The most lightweight and flexible form library out there for React

Latest version **0.0.1** (published 2023-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install formunition
pnpm add formunition
yarn add formunition
bun add formunition
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-04-25 |
| First published | 2023-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Naveen Kumarasinghe |
| Maintainers | kumarasinghe |
| Keywords | react, form, lightweight, validation, small, fast, thin, formik, react-hook-form, react-final-form |

## Links

- npm: https://www.npmjs.com/package/formunition
- Repository: https://github.com/kumarasinghe/formunition
- Homepage: https://github.com/kumarasinghe/formunition#readme
- Issues: https://github.com/kumarasinghe/formunition/issues
- npm.io page: https://npm.io/package/formunition

## 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

- 0.0.1 (latest) — 2023-04-25

## README

# Formunition

![formunition logo](./formunition-logo.png)

### The most lightweight and flexible form library out there for React!

#### 🐤 As tiny as 1 KB in size (gzipped)

#### 🔀 Effortlessly works with UI component libraries

#### 🛡️ Easy validations with RegExp and Zod

#### 🚀 Designed with simplicity and performance in mind

### Install

```sh
npm install formunition
```

### Usage

```tsx
// LoginForm.tsx

import React, { useState } from "react";
import Form, { ValidationResult } from "formunition";

export default function LoginForm() {
  const [validations, setValidations] = useState<ValidationResult>({});

  const validators = {
    email: /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/, // or z.string().email(),
    password: /.{8,}$/,
  };

  return (
    <Form
      onSubmit={console.log}
      onValidate={setValidations}
      validators={validators}
    >
      <div>
        <input type="email" name="email" placeholder="Email" />
        {validations.email === "fail" && <p>Invalid email!</p>}
      </div>
      <div>
        <input type="password" name="password" placeholder="Password" />
        {validations.password === "fail" && <p>Weak password!</p>}
      </div>
      <button type="submit">Login</button>
    </Form>
  );
}
```

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