All Projects → pburtchaell → react-input

pburtchaell / react-input

Licence: MIT license
A single component for building forms in React

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects
HTML
75241 projects

Projects that are alternatives of or similar to react-input

Ant Plus
🔺 Ant Design 表单简化版
Stars: ✭ 212 (+381.82%)
Mutual labels:  form
Jh flutter demo
a flutter demo
Stars: ✭ 229 (+420.45%)
Mutual labels:  form
Vue Form Json Schema
Create forms using JSON schema. Bring your components!
Stars: ✭ 253 (+475%)
Mutual labels:  form
Angular Surveys
Angular survey / form builder inspired by Google Forms
Stars: ✭ 219 (+397.73%)
Mutual labels:  form
Learn To Send Email Via Google Script Html No Server
📧 An Example of using an HTML form (e.g: "Contact Us" on a website) to send Email without a Backend Server (using a Google Script) perfect for static websites that need to collect data.
Stars: ✭ 2,718 (+6077.27%)
Mutual labels:  form
Form bloc
🔥 Dart and Flutter Package 🔥 Easy Form State Management using BLoC pattern 🔥 Wizard/stepper forms, asynchronous validation, dynamic and conditional fields, submission progress, serialization and more! 🔥
Stars: ✭ 239 (+443.18%)
Mutual labels:  form
Floatl
☁️ A pragmatic implementation of the Float Label Pattern for the web
Stars: ✭ 204 (+363.64%)
Mutual labels:  form
elderform
💪🏽 Form creation made easy, backed by state machines
Stars: ✭ 30 (-31.82%)
Mutual labels:  form
React Hooks Helper
A custom React Hooks library that gives you custom hooks for your code.
Stars: ✭ 227 (+415.91%)
Mutual labels:  form
Final Form
🏁 Framework agnostic, high performance, subscription-based form state management
Stars: ✭ 2,787 (+6234.09%)
Mutual labels:  form
Vue Dynamic Form Component
Vue dynamic nested form component, support nested Object/Hashmap/Array. Vue动态多级表单组件,支持嵌套对象/Hashmap/数组。
Stars: ✭ 220 (+400%)
Mutual labels:  form
Resolvers
📋 Validation resolvers: Zod, Yup, Joi, Superstruct, and Vest.
Stars: ✭ 222 (+404.55%)
Mutual labels:  form
Fui
Add CLI & form interface to your program. Docs: https://docs.rs/fui
Stars: ✭ 244 (+454.55%)
Mutual labels:  form
Kirby Uniform
A versatile Kirby plugin to handle web form actions.
Stars: ✭ 214 (+386.36%)
Mutual labels:  form
react-plough
A library to help tend your react form fields
Stars: ✭ 31 (-29.55%)
Mutual labels:  form
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+5293.18%)
Mutual labels:  form
Htmlpurifierbundle
HTML Purifier is a standards-compliant HTML filter library written in PHP.
Stars: ✭ 234 (+431.82%)
Mutual labels:  form
react-apollo-form
Build React forms based on GraphQL APIs.
Stars: ✭ 195 (+343.18%)
Mutual labels:  form
WP-Media-Uploader
Easily create a custom media upload button in WordPress admin dashboard that you can use in your plugin
Stars: ✭ 25 (-43.18%)
Mutual labels:  form
Django Bootstrap Modal Forms
A Django plugin for creating AJAX driven forms in Bootstrap modal.
Stars: ✭ 244 (+454.55%)
Mutual labels:  form

React Input

Warning

As of 2018 July 7, this project is depreciated and unmaintained. The package is still available on npm, but I would suggest finding an alternative.

Good alternatives include:

Overview

React input is a lightweight, dependency free component for building forms in React without having to think about what happens under the hood. It uses one component and an array of objects that describe the inputs in the form.

Usage

Install the component via npm: npm install react-input.

<Form
  fields={[
    {
      name: 'Email',
      key: 'email',
      type: 'email',
      error: false,
      required: false,
      placeholder: 'Enter an email',
      onChange: value => {
        // handle a changed value on the input
      },
      renderAfter: () => (
        <div>Include an element after the input, which is useful for instructional text or strength meters for passwords</div>
      ),
      renderBefore: () => (
        <div>Include an element before the input</div>
      )
    },
    // additional inputs to include in the form
  ]}
  onChange={state => /* handle form change */ }
  onSubmit={state => /* handle form submit */ }
/>

For a detailed example, see the example project.

Form Props

Name Type Description Required Default
fields array Array of inputs to include true
labels boolean If false, labels are disabled true
isPending boolean If true, an .is-pending class is added to the form null
isRejected boolean If true, an .is-rejected class is added to the form null
isFulfilled boolean If true, an .is-fulfilled class is added to the form null

The isPending, isRejected and isFulfilled props are useful to add different styles to the form for different states.

Form Events

Event Description
onChange Runs when any input in the form changes. The first parameter is the state of the form after the change.
onSubmit Runs when the submit button is clicked. The first parameter is the current state of the form.

Input Properties and Events

Only text based inputs can be used, e.g., email, text, tel and password.

Properties

Name Type Description Required Default
key string Unique key for the field true
type string The type of input 'text'
name string The name of input
label boolean Label for the input field true
required boolean Make field required true
error boolean Is the input in an error state? false
renderAfter function Element to render after the input
renderBefore function Element to render before the input

Events

Event Description
onChange Runs when the value of the input changes. The first parameter is the value.

In addition to the props listed above, all standard HTML input attributes are supported and can be used as props on the inputs.


Copyright 2015 Patrick Burtchaell. Licensed MIT.

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].