This package has been deprecated

Author message:

This package is no longer maintained. Please use react-hook-form instead

@adeon/form

1.0.2 • Public • Published

Description

Smart React form component written with hooks

Basic component example

import React from 'react';

import { Form, Field } from '@adeon/form';

const Component = () => {
  const handleSubmit = useCallback(formState => {
    console.log(formState);
  }, []);

  return (
    <Form onSubmit={handleSubmit}>
      <Field name="name" type="text" />
      <Field name="email" type="email" defaultValue="example@gmail.com" />
      <Field name="description" type="textarea" />
      <p>Example checkbox: <Field name="" type="checkbox" defaultChecked={false} /></p>

      <button type="submit">Submit</button>
    </Form>
  );
}

export default Component;

Custom component example

import React from 'react';

import { Form, Field } from '@adeon/form';

const Component = () => {
  const handleSubmit = useCallback(formState => {
    console.log(formState);
  }, []);

  return (
    <Form onSubmit={handleSubmit}>
      {formState => (
        <>
          <Field name="name" type="text" />
          <p>Your name is: {formState.name}</p>

          <button type="submit">Submit</button>
        </>
      )}
    </Form>
  );
}

export default Component;

Readme

Keywords

Package Sidebar

Install

npm i @adeon/form

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

484 kB

Total Files

47

Last publish

Collaborators

  • adeonmaster