npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

blitz-form-builder

v0.0.10

Published

A simple form builder to create and manage complex forms

Readme

blitz-form-builder

blitz-form-builder is a React package built on top of Material-UI and react-hook-form. It simplifies the process of creating single & multi step forms, making it up to 20 times faster to build and manage complex forms in your React applications.

Features

  • Easy-to-use API: A declarative syntax to define forms and fields.
  • Material-UI Integration: Leverages Material-UI components for a seamless and consistent design.
  • React Hook Form: Provides robust form validation and state management out of the box.
  • Customizable: Easily extend and override default behaviors to meet specific requirements.
  • Performance Optimized: Minimal re-renders and high efficiency thanks to react-hook-form's architecture.

Installation

Install the package via npm or yarn:

npm install blitz-form-builder
# or
yarn add blitz-form-builder

Quick Start

Here’s a basic example to get started:

import { FormBuilder, Template } from "blitz-form-builder";

function App() {
  const template: Template = {
    config: [
      {
        type: "textfield",
        label: "Email address",
        name: "email",
      },
      {
        type: "textfield",
        label: "First Name",
        name: "firstname",
      },
      {
        type: "textfield",
        label: "Last Name",
        name: "lastname",
      },
    ],
  };

  return (
    <>
      <FormBuilder
        onSubmit={(data) => console.log(data)}
        template={[template]}
      />
    </>
  );
}

export default App;

Configuration Options

The config object allows you to define the form structure and behavior:

  • fields: An array of field definitions, currently blitz-form-builder supports ("textfield" "date", "select", "radio", "checkbox", "autocomplete", "rating", "switch", "render"). Each field supports the following properties:

    • name: (string) Unique identifier for the field.
    • label: (string) Label displayed alongside the field.
    • type: (string) Field type (e.g., 'textfield', 'date', 'select', etc.).
    • formControlProps?: Provides context such as filled/focused/error/required for form inputs. Relying on the context provides high flexibility and ensures that the state always stays consistent across the children of the FormControl.
    • formLabelProps?: Provides context for the field label;
    • fieldProps?: field customization

Field Customization

To customize your field use the fieldProps option to access its attributes

{
    type: "textfield",
    label: "Email address",
    name: "email",
    fieldProps() {
        return { size: "medium", fullWidth: true, variant: "outlined" };
    },
},

To handle your fields based on your form's state you can access your state like follows

{
    type: "textfield",
    label: "Email address",
    name: "email",
    fieldProps(props) {
    const { watch } = props;
    const firstname = watch("firstname");
      if (firstname === "jack") {
        return { disabled: true };
      }
    }
}

Form builder props

blitz-form-builder extends the html form attributes in addition to those important ones:

  • schema validation: We also support schema-based form validation with Yup, Zod , Superstruct & Joi, where you can pass your schema to useForm as an optional config. It will validate your input data against the schema and return with either errors or a valid result.
const LoginSchema = Yup.object().shape({
    email: Yup.string().required("email is required").email("email is wrong"),
  });

  ...
  ...

  <FormBuilder
    validationSchema={LoginSchema}
    ...
    ...
    />
  • form control: Control form validation mode and other necessary behaviours using formProps which contains these props:

mode: Validation strategy before submitting behaviour.

reValidateMode: Validation strategy after submitting behaviour.

defaultValues: Default values for the form.

values: Reactive values to update the form values.

errors: Reactive errors to update the form errors.

resetOptions: Option to reset form state update while updating new form values.

criteriaMode: Display all validation errors or one at a time.

shouldFocusError: Enable or disable built-in focus management.

delayError: Delay error from appearing instantly.

shouldUseNativeValidation: Use browser built-in form constraint API.

shouldUnregister: Enable and disable input unregister after unmount.

 <FormBuilder
    formProps={{
        defaultValues: {
            email: "[email protected]",
        },
        mode: "onBlur",
    }}
  • form provider: provides React Context to your form using the formProvider prop
  • stepper props: if your form is a multi stepper, you can use the stepperProps to customize it and provide titles for each step, e.g.
<FormBuilder
    template={[template]}
    stepperProps={{
        titles: ["Genaral information", "Documents upload"],
    }}
    />
</>
  • form submition: the formBuilder offers a onSubmit prop to submit your component
  const template: Template = {
    config: [
      {
        type: "textfield",
        label: "Email address",
        name: "email",
        fieldProps(props) {
          const { watch } = props;
          const firstname = watch("firstname");
          console.log(firstname);
          if (firstname === "jack") {
            return { disabled: true };
          }
        },
      },
      {
        type: "textfield",
        label: "First Name",
        name: "firstname",
      },
      {
        type: "textfield",
        label: "Last Name",
        name: "lastname",
      },
      {
        type: "render",
        name: 'render',
        RenderComponent: () => {
          return <Button type="submit">Submit</Button>
        }
      }
    ],
  };

  return (
    <>
      <FormBuilder
        template={[template]}
        formProps={{
          defaultValues: {
            radio: 2,
            email: "[email protected]",
            select: "1",
          },
          mode: "onBlur",
        }}
        onSubmit={(data) =>
            console.log(data)
            // make your api call
        }
      />
    </>
  );
}

Multi step form

To create a multi step form just add multiple templates to the template prop array

const step1: Template = {
    config: [
      {
        type: "textfield",
        name: "name",
        fieldProps() {
          return { variant: "filled" };
        },
      },
    ],
  };

  const step2: Template = {
    config: [
      {
        type: "switch",
        name: "boolean",
      },
    ],
  };

  return (
    <FormBuilder
      template={[step1, step2]}
      onSubmit={(data) => console.log(data)}
    />
  );
}

Contributing

We welcome contributions! If you have suggestions or encounter issues, please open an issue or submit a pull request.

License

blitz-form-builder is licensed under the MIT License.


Happy form building! 🚀