0.4.1 • Published 7 years ago

react-bforms v0.4.1

Weekly downloads
5
License
MIT
Repository
-
Last release
7 years ago

React Bootstrap Forms

Demo

Quick example

import BForms from 'react-bforms';
var {Form, Input} = BForms;


export class LoginForm extends React.Component {

    render() {
        return (
            <Form ref='form' onSubmit={this._onSubmit.bind(this)}>
                <Input name='username'
                       label='Email'
                       type='email'
                       validators={[username()]}/>

                <Input name='password'
                       label='Password'
                       type='password'
                       validators={[password()]}/>

                <div>
                    <button className='btn btn-primary'>Login</button>
                </div>
            </Form>
        );
    }

    _onSubmit() {
        var values = this.refs.form.getValues();
        console.log(values);
    }
};


var username = function(message) {
    message = message || 'Example: username@example.com';

    return function(value) {
        if (value.indexOf('@') === -1) {
            return message;
        }

        return '';
    };
};


var password = function(message) {
    message = message || 'Please enter password';

    return function(value) {
        if (!value) {
            return message;
        }

        return '';
    };
};
0.4.1

7 years ago

0.4.0

9 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago