formite-html
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

formite-html

Easy forms with React hooks

Use formite with HTML input elements.

Installation

npm install formite-core formite-html

or

yarn add formite-core formite-html

Usage

import { useForm, useInput } from "formite-html"
 
const handleSubmit = (values: unknown) => {
    console.log(values);
};
 
const SimpleForm = () => {
    const { canSubmit, fields, Form, isDirty } = useForm({ firstName: "", lastName: "" }, handleSubmit);
    return (
        <Form>
            <input type="text" placeholder="First name" {...useInput(fields.firstName)} />
            <input type="text" placeholder="Last name" {...useInput(fields.lastName)} />
            <button type="submit" disabled={!(canSubmit && isDirty)}>Save</button>
        </Form>
    );
};

See Storybook for more examples.

Readme

Keywords

Package Sidebar

Install

npm i formite-html

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

32.9 kB

Total Files

14

Last publish

Collaborators

  • joerneu