All Projects → kettanaito → React Advanced Form

kettanaito / React Advanced Form

Licence: mit
Functional reactive forms. Multi-layer validation, custom styling, field grouping, reactive props, and much more.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Advanced Form

Qmbform
Create simple Android forms
Stars: ✭ 184 (-1.08%)
Mutual labels:  validation, form
Bootstrap Validate
A simple Form Validation Library for Bootstrap 3 and Bootstrap 4 not depending on jQuery.
Stars: ✭ 112 (-39.78%)
Mutual labels:  validation, form
Legit
input validation framework
Stars: ✭ 81 (-56.45%)
Mutual labels:  validation, form
Just Validate
Lightweight (~4,5kb gzip) form validation in Javascript Vanilla, without dependencies, with customizable rules (including remote validation), customizable messages and customizable submit form with ajax helper.
Stars: ✭ 74 (-60.22%)
Mutual labels:  validation, form
Fonk
Form schema validation library
Stars: ✭ 125 (-32.8%)
Mutual labels:  validation, form
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-57.53%)
Mutual labels:  validation, form
Ngx Dynamic Form Builder
FormBuilder + class-transformer + class-validator = dynamic form group builder for Angular10+
Stars: ✭ 93 (-50%)
Mutual labels:  validation, form
Mobx React Form
Reactive MobX Form State Management
Stars: ✭ 1,031 (+454.3%)
Mutual labels:  validation, form
Ratifier
Ratifier is a form validation library for Android.
Stars: ✭ 123 (-33.87%)
Mutual labels:  validation, form
Vue Formulate
⚡️ The easiest way to build forms with Vue.
Stars: ✭ 1,947 (+946.77%)
Mutual labels:  validation, form
Awesomevalidation
Android validation library which helps developer boil down the tedious work to three easy steps.
Stars: ✭ 1,093 (+487.63%)
Mutual labels:  validation, form
Formhelper
ASP.NET Core - Transform server-side validations to client-side without writing any javascript code. (Compatible with Fluent Validation)
Stars: ✭ 155 (-16.67%)
Mutual labels:  validation, form
Ng Bootstrap Form Validation
An Angular Module for easy data driven (reactive) form validation
Stars: ✭ 57 (-69.35%)
Mutual labels:  validation, form
Simple React Validator
A simple react form validator inspired by Laravel validation.
Stars: ✭ 170 (-8.6%)
Mutual labels:  validation, form
Formik Alicante
Formik slides & demos from React Alicante
Stars: ✭ 47 (-74.73%)
Mutual labels:  validation, form
React Native Merlin
🧙 Simple web-like forms in react native.
Stars: ✭ 83 (-55.38%)
Mutual labels:  validation, form
Vuelidation
simple, powerful, vuejs validation.
Stars: ✭ 38 (-79.57%)
Mutual labels:  validation, form
Usetheform
React library for composing declarative forms, manage their state, handling their validation and much more.
Stars: ✭ 40 (-78.49%)
Mutual labels:  validation, form
React Form With Constraints
Simple form validation for React
Stars: ✭ 117 (-37.1%)
Mutual labels:  validation, form
Form Validation.js
The most customizable validation framework for JavaScript.
Stars: ✭ 127 (-31.72%)
Mutual labels:  validation, form

Package version Build status Vulnerabilities Dependencies status DevDepenencies status Greenkeeper badge

React Advanced Form

React Advanced Form

React Advanced Form is a library for tailoring real-world forms in React with pleasure and ease.


Features

Expectations shift

Trust and expect a form to do more than just rendering the fields. Our features are designed to handle cumbersome use cases with clean and performant code

Immutable

Each field interaction or update is a pure function that produces the next state of a field.

Composite fields

React Advanced Form is field-centric. That means you define flexible fields composites and reuse them throughout the application. Reflect even the most granular field state changes in the UI to achieve the outmost user experience.

import React from 'react'
import { createField, fieldPresets } from 'react-advanced-form'

const Input = ({ fieldState, fieldProps }) => {
  const { valid, invalid } = fieldState

  const classNames = [valid && 'has-success', invalid && 'has-error'].filter(
    Boolean,
  )

  return <input {...fieldProps} className={classNames.join(' ')} />
}

export default createField(fieldPresets.input)(Input)

Clean and fast

Develop production-ready forms in a speed of a prototype.

// This is not a diminished example, this is a finite form
<Form action={this.registerUser}>
  <Input name="username" required />
  <Input name="password" type="password" required />
</Form>

Layered validation schema

Select fields and declare validation rules using resolver functions. Utilize the order and priority of their execution to craft validation logic of any complexity.

export default {
  type: {
    password: {
      capitalLetter: ({ value }) => /[A-Z]/.test(value),
      oneNumber: ({ value }) => /[0-9]/.test(value),
    },
  },
  name: {
    confirmPassword: ({ get, value }) => {
      /**
       * The "confirmPassword" field will be re-validated whenever
       * the "value" prop of "userPassword" field updates.
       */
      return value === get(['userPassword', 'value'])
    },
  },
}

Each validation resolver can access respective field's value, fieldProps, and the form as the parameters. It can also reference other field's state via the get function, which creates a props subscription to re-evaluate the respective validation rule in real time.

Say goodbye to crowded validate functions, welcome clean validation schema!

Reactive props

How much effort would it take you to make one field required based on another field(s)? Yes, the correct answer is—one line of code:

<Input
  name="firstName"
  required={({ get }) => !!get(['lastName', 'value'])} />
<Input
  name="lastName"
  required={({ get }) => !!get(['firstName', 'value'])} />

Get as many data from the sibling fields as needed, and build your logic around that. Rely on reactive programming that will re-evaluate a resolver function whenever the referenced field props update.

Field grouping

Control the serialized data structure on the layout level by grouping the fields. Take advantage of nested and split groups.

<Input name="companyName" value="Google" />

<Field.Group name="billingAddress">
  <Input name="firstName" value="John" />
  <Input name="lastName" value="Maverick" />
</Field.Group>

<Checkbox name="termsAndConditions" checked />

<Field.Group name="deliveryAddress">
  <Input name="firstName" value="Catheline" />
  <Input name="lastName" value="McCoy" />
</Field.Group>

The form above serializes into the following JSON:

{
  "companyName": "Google",
  "billingAddress": {
    "firstName": "John",
    "lastName": "Maverick"
  },
  "termsAndConditions": true,
  "deliveryAddress": {
    "firstName": "Catheline",
    "lastName": "McCoy"
  }
}

Third-party integration

React Advanced Form can be used with any third-party fields library by using powerful createField API. It also allows to create custom fields from literally any component.


Getting started

Install

npm install react-advanced-form --save

Make sure to have React (15.0+) installed in your project.

Guidelines

Starting with something new may appear challenging. We have prepared step-by-step instructions on how to Get started with React Advanced Form to make the adoption process clear and fast.


Materials


Browser support

Chrome Firefox Safari iOS Safari Edge Internet Explorer
65+ 57+ 9+ 8+ 41+ 11*

* There is no official support for Internet Explorer. Consider educating the web and deprecating legacy browsers.


Live examples


Contributing

Any of your contributions are highly appreciated. Please read through the Contribution guidelines beforehand. Development isn't the only way to support, there are many more.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].