An example of a schema-based form system for React.

Overview

React Advanced Form

An example of a schema-based form system in React. Define your schema, and pass it into the form. Supports basic conditional schema.

Example

The schema system support text input, checkbox, radio group, select, textarea, and conditonal fields. It is presented in these examples with plain HTML and CSS based forms, but can easily be modified for use with any React UI framework, such as Material UI, Semantic UI, etc.

const formSchema = [
  { name: 'name', label: 'Name', componentType: 'text', required: true },
  { name: 'playable', label: 'Playable', componentType: 'checkbox' },
  {
    name: 'race',
    label: 'Race',
    componentType: 'radioGroup',
    options: [
      { label: 'Human', value: 'human' },
      { label: 'Dwarf', value: 'dwarf' },
      { label: 'Elf', value: 'elf' },
    ],
  },
  {
    name: 'class',
    label: 'Class',
    componentType: 'select',
    options: [
      { label: 'Ranger', value: 'ranger' },
      { label: 'Wizard', value: 'wizard' },
      { label: 'Healer', value: 'healer' },
    ],
  },
  {
    name: 'spell',
    label: 'Spell',
    componentType: 'select',
    options: [
      { label: 'Fire', value: 'fire' },
      { label: 'Ice', value: 'ice' },
    ],
    condition: { key: 'class', value: 'wizard', operator: '=' },
  },
  {
    name: 'description',
    label: 'Description',
    componentType: 'textarea',
  },
]

Simply pass the schema into the component, and handle the submit event.

<AdvancedForm schema={formSchema} onSubmit={handleSubmit} />
You might also like...

Income Expense Tracker is a user based income-expense tracking system featuring budget planning and statistical analysis.

Income-Expense-Tracker Features Income Expense Tracker is a user based income-expense tracking system featuring budget planning and statistical analys

Oct 6, 2022

Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.

Recoil · Recoil is an experimental set of utilities for state management with React. Please see the website: https://recoiljs.org Installation The Rec

Jan 8, 2023

Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with Material Design.

Material-UI Quickly build beautiful React apps. Material-UI is a simple and customizable component library to build faster, beautiful, and more access

Dec 30, 2022

:atom_symbol: React primitive UI components built with styled-system.

Rebass React primitive UI components built with Styled System. https://rebassjs.org npm i rebass Getting Started import React from 'react' import { Bo

Dec 31, 2022

An implementation of GitHub's Primer Design System using React

An implementation of GitHub's Primer Design System using React

Primer React A React implementation of GitHub's Primer Design System Documentation Our documentation site lives at primer.style/react. You'll be able

Dec 26, 2022

Fill the boring catsalud covid vaccine form with a console command

vacunacovid-catsalud-autofullfill form Fill the boring catsalud covid vaccine form with a console command Manual use, pasting in the script in the con

Jul 27, 2021

Phonemask - Library for processing the phone input field in the web form. Only native javascript is used

phonemask Library for processing the phone input field in the web form. Only native javascript is used Usage: Adding a library to HTML script type="a

Sep 20, 2022

A Drag & Drop Form Builder base on Bootstrap v4.x

A  Drag & Drop Form Builder base on Bootstrap v4.x

bsFormBuilder 一个基于 Bootstrap (v4.x) + JQuery 的、拖拽的表单构建工具。 特点 1、基于 Bootstrap (v4.x) + JQuery,简单易用 2、拖动的 html 组件,支持通过 Json 自定义扩展 3、组件的属性面板,支持通过 Json 自定义

Aug 25, 2022

Example project using Miniflare, esbuild and AVA

Miniflare Example Project This is an example Cloudflare Workers project that uses Miniflare for local development, esbuild for bundling, and AVA for t

Dec 3, 2022
A Higher Order Component using react-redux to keep form state in a Redux store

redux-form You build great forms, but do you know HOW users use your forms? Find out with Form Nerd! Professional analytics from the creator of Redux

Redux Form 12.6k Jan 3, 2023
ESLint plugin for react-hook-form

eslint-plugin-react-hook-form react-hook-form is an awsome library which provide a neat solution for building forms. However, there are many rules for

Chuan-Tse Kao 37 Nov 22, 2022
An easy-to-use super customisable form validation library for React.

An easy-to-use super customisable form validation library for React. This library handles all of your form states using built in useReducer hook of react.

Himanshu Bhardwaz 2 Jun 30, 2022
Form handler in React-MobX

MobX Light Form ✨ MobX Form State Management with automatic validation Seperate subjects which manage form data to prevent duplication of data and ens

정윤재 3 Nov 30, 2022
🪱 Zorm - Type-safe
for React using Zod

React Zorm Type-safe <form> for React using Zod! Features / opinions ?? Type-safe Get form data as a typed object Typo-safe name and id attribute gene

Esa-Matti Suuronen 503 Dec 25, 2022
React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in

A comprehensive starter kit for rapid application development using React. Why Slingshot? One command to get started - Type npm start to start develop

Cory House 9.8k Dec 22, 2022
An example of a fast food ordering app with Ionic React

ionic-fast-food-app An example of a Food Ordering app in Ionic React Included in this Ionic React Template/UI Data fetching from JSON files Global sta

Alan Montgomery 25 Nov 28, 2022
An example of a travel style app built with Ionic React

ionic-react-travel-app An example of a travel style app built with Ionic React If you'd like to support, you can buy me a coffee ☕️ Included in this I

Alan Montgomery 29 Sep 27, 2022
Redux-Toolkit example with React Hooks CRUD Application, Axios, Rest API, Bootstrap

Redux-Toolkit CRUD example with React Hooks, Axios & Web API Build Redux-Toolkit CRUD application with React Hooks and Rest API calls in that: Each it

null 69 Dec 27, 2022
Free Open Source High Quality Dashboard based on Bootstrap 4 & React 16: http://dashboards.webkom.co/react/airframe

Airframe React High Quality Dashboard / Admin / Analytics template that works great on any smartphone, tablet or desktop. Available as Open Source as

Mustafa Nabavi 6 Jun 5, 2022