3.11.2 • Published 3 years ago

@tdc-cl/x-form v3.11.2

Weekly downloads
117
License
MIT
Repository
github
Last release
3 years ago

@tdc-cl/x-form

Declarative forms for React

NPM code style: prettier License: MIT

Created at The Dog Company

Good news!

You can already use the new nomenclature for fields, e.g. text instead of $Text, for versions >= 3.2.0.

Installation

  • Install x-form and its peer dependencies, using your package manager of choice

Option 1: npm

npm install --save @tdc-cl/x-form immutable js-joda decimal.js

Option 2: yarn

yarn add @tdc-cl/x-form immutable js-joda decimal.js

For TypeScript users, type definitions are already included, so you don't need to install a @types/... package.

Basic usage

Let's create a login form

import { useForm, $Form, $Text, $Password, $Checkbox, $Button } from '@tdc-cl/x-form';

function MyLoginFormComponent() {
    const form = useForm($Form({
        fields: {
            user: $Text('Username'),
            pass: $Password(),
            remember: $Checkbox('Remember me'),
        },
        submit: $Button('Log in', {
            async onValid(values) {
                // make a request to your endpoint here
            },
            onInvalid: 'disable',
        }),
    }));

    return form.render();
}

Documentation

https://hackmd.io/izREMyHCQAKNmNZOq7ujmw

License

MIT © Robin40

3.11.2

3 years ago

3.11.1

3 years ago

3.11.0

3 years ago

3.10.0

3 years ago

3.9.0

3 years ago

3.8.1

3 years ago

3.8.0

3 years ago

3.7.0

3 years ago

3.6.0

3 years ago

3.4.0

3 years ago

3.5.0

3 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.6.0

3 years ago

2.5.2

4 years ago

2.5.3

4 years ago

2.5.1

4 years ago

2.5.0

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.0

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

1.0.2

4 years ago

2.0.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago