niceform-hook
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Niceform-hook

Context-API license NPM PNPM React-hook-form RollupJS

imagem de exemplo

Niceform-hook is a library written on top of react-hook-form, focusing on rendering form fields integrated into your project's design-system. With its power you can easily render your form fields using json, saving time when writing code.

The niceform hook is very complete, designed precisely to meet different types of needs for implementing and using a form.

Install

npm install niceform-hook

Quickstart

import useNiceForm from "./Form.config";

export function App() {
  const form = useNiceForm();

  return (
    <NiceformHookProvider form={form}>
      <form
        className="grid grid-cols-4"
        onSubmit={form.methods.handleSubmit(console.log)}
      >
        <div>
          {form.renderField({
            type: "text",
            name: "name",
            label: "Name",
          })}
        </div>

        <div>
          {form.renderField({
            type: "text",
            name: "service_type",
            label: "Service Type",
          })}
        </div>

        <div>
          {form.renderField({
            type: "email",
            name: "user",
            label: "User",
          })}
        </div>

        <div>
          {form.renderField({
            type: "password",
            name: "password",
            label: "Password",
          })}
        </div>

        <button type="submit">Send</button>
      </form>
    </NiceformHookProvider>
  );
}

Documentation

Storybook Documentation

/niceform-hook/

    Package Sidebar

    Install

    npm i niceform-hook

    Weekly Downloads

    112

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    228 kB

    Total Files

    109

    Last publish

    Collaborators

    • rodrigosantos99_