0.0.8 • Published 8 years ago

@brllnt/react-form v0.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

React Form

Simple form component for React applications. This component is very much in alpha and the API will be changing rapidly.

Installation

npm install @brllnt/react-form

Usage

import Form, { Field } from '@brllnt/react-form'

const LoginForm = () => (
    <Form onChange={values => console.log(values)}>
        <Field name="email" type="email" />
        <Field name="password" type="password" />
        <button type="submit">Submit</button>
    </Form>
)

API

<Form>

Props
nametypedescription
onChangefunctionFires every time an input is changed: onChange(values)
onSubmitfunctionFires on submit: onChange(values)

onChange and onSubmit both are called with one parameter, an object with the keys being the names of each field

<Field>

Props
nametypedescription
namestringName of the property (also what will be used as the key in the values object)
typestringType of input
componentstring or ComponentComponent to use for the input (defaults to input)
0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago