GithubHelp home page GithubHelp logo

9612jhf / react-form-inputs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from korbin/react-form-inputs

0.0 2.0 0.0 132 KB

A collection of inputs for react-form

License: MIT License

JavaScript 100.00%

react-form-inputs's Introduction

react-form-inputs

npm version Build Status

Synopsis

react-form-inputs is a baseline collection of pluggable input components for react-form.

Components

Name Type Browser Support Details on Props Valid initial values Comments
Base Internal All browsers Pass-through to input String-like values Shim for other components. Should not be used directly.
Boolean Extended All browsers Optional checkedValue, uncheckedValue true, false, "true", "false", 1, 0 Creates both a hidden input (uncheckedValue) and a checkbox input (checkedValue). Servers accepting POSTs must always use the last-encoded value.
Checkbox Array All browsers Requires collection (object or array) Array of String-like values Creates a consistently-named checkbox input for each array item or key-value pair in collection. Value is always an array.
Color Standard (HTML5) Modern browsers Pass-through to input Hex color strings
Datalist Array Modern browsers Pass-through to input, requires array collection String-like values Creates a datalist and accompanying input field. Collection must be an array of String-like values.
Date Standard (HTML5) Modern browsers Pass-through to input Date strings
Datetime Standard (HTML5) Modern browsers Pass-through to input Datetime-local strings Uses datetime-local for greater browser compatibility.
Email Standard (HTML5) Modern browsers Pass-through to input Valid email strings
Hidden Standard All browsers Pass-through to input String-like values
Number Extended All browsers Pass-through to input, pattern (regex string) Numeric String-like values Implemented using an enhanced "text" input. Does not allow entry of non-numeric characters. Decimals okay.
Password Standard All browsers Pass-through to input String-like values
Radio Array All browsers Requires collection (object or array) String-like values (within collection) Creates a label and matching radio button for each array item or key-value pair in collection. Value is always a single value contained within collection.
Range Standard (HTML5) Modern browsers Pass-through to input, min, max, step Numeric String-like values
Search Standard (HTML5) Modern browsers Pass-through to input String-like values
Select Array All browsers Requires collection (object or array), optional multiple (boolean) String-like values (within collection) Creates a select or multi-select with an option for each array item or key-value pair in collection. If props.multiple=true, value is always an array of value(s) from collection, else value is a single , non-array value from collection.
Text Standard All browsers Pass-through to input String-like values Standard, work-horse input component
Textarea Standard All browsers Pass-through to textarea String-like values
Time Standard (HTML5) Modern browsers Pass-through to input String time (HH:MM) values

A note on array-type (collection) components

Any array-type component accepting a collection consisting of an object or array will behave similarly.

If collection is an array of values: those values will be used for both the visible label and underlying "value" used for selection/form submission.

If collection is an object (key-value pairs): object keys will be visible to users, object values will be used as the underlying "value" used for selection/form submission.

Tips

  • To reduce over-the-wire payload, only require specific components:
    var Text = require('react-form-inputs/text');

Developing

Install gulp, dependencies:

npm install -g gulp
npm install

Build it!:

#To build once:
gulp build

#To watch and rebuild on changes:
gulp watch

Link dependent project to ./dist/:

#Within dependent project directory...
npm link ~/path-to-react-form-inputs/dist/

Contributing

  • Fork the project.
  • Create a descriptively-named branch for your changes. (fix_whatever, add_this)
  • Commit your change.
  • Add appropriate documentation, test coverage.
  • Test with "npm test" (requires jest-cli).
  • Issue a pull request for your branch.

License

react-form-inputs is released under the MIT License.

react-form-inputs's People

Contributors

korbin avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.