@opentf/react-form
TypeScript icon, indicating that this package has built-in type declarations

0.22.0 • Public • Published

 OPEN TECH FOUNDATION

React Form

Build

A simple form state manager for React.

Features

  • Simple APIs to use

  • Supports nested & array fields

  • Supports form validation (Works with any schema validation lib)

  • Render optimized

  • TypeScript support

Installation

npm install @opentf/react-form
yarn add @opentf/react-form
pnpm add @opentf/react-form
bun add @opentf/react-form

Usage

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

export default function App() {
  return (
    <Form
      initialValues={{ field1: '', field2: '' }}
      onSubmit={(values) => {
        console.log(values);
      }}
    >
      <Field name="field1" />
      <Field name="field2" type="number" />
      <button type="submit">Submit</button>
    </Form>
  );
}

Examples

License

Copyright (c) Thanga Ganapathy (MIT License).

Package Sidebar

Install

npm i @opentf/react-form

Weekly Downloads

5

Version

0.22.0

License

MIT

Unpacked Size

73.8 kB

Total Files

9

Last publish

Collaborators

  • ganapathy