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

@korytnikov_n/react-config-form

v0.1.1

Published

Configurable multi-step form library for React

Downloads

272

Readme

React Config Form

npm typescript license

A configurable multi-step form library for React with built-in validation and TypeScript support.

The library allows developers to build forms using a configuration object instead of manually managing form state, validation logic, and step navigation.


✨ Why Use React Config Form?

  • Build forms from configuration objects
  • Reduce repetitive form boilerplate
  • Centralize validation logic
  • Easily create multi-step forms
  • Handle client-side and server-side validation consistently
  • Reuse form configurations across projects

✨ Features

  • Config-driven form rendering
  • Multi-step form support
  • Built-in validation system
  • Validation on change or blur
  • Async submit handling
  • Server-side error support
  • TypeScript support
  • Extensible field architecture
  • Rollup library build setup
  • Jest tests included

📋 Requirements

  • React 18+
  • TypeScript recommended

📦 Installation

npm install @korytnikov_n/react-config-form

🚀 Quick Start

import Form, { Config, FieldsTypes } from "@korytnikov_n/react-config-form";

const config: Config = {
  fields: {
    email: {
      type: FieldsTypes.Input,

      validateOn: "blur",

      validation: {
        required: {
          isRequired: true,
        },

        regExp: {
          reg: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
        },
      },
    },

    password: {
      type: FieldsTypes.Input,

      validateOn: "change",

      validation: {
        length: {
          min: 8,
          max: 12,
        },
      },
    },

    gender: {
      type: FieldsTypes.Radio,

      options: [
        {
          value: "f",
          name: "Female",
        },

        {
          value: "m",
          name: "Male",
          default: true,
        },
      ],
    },
  },

  steps: [["email", "password"], ["gender"]],

  validateOnNext: true,
};

function handleSubmit(data: unknown) {
  console.log(data);

  return Promise.resolve({});
}

export default function App() {
  return <Form config={config} onSubmit={handleSubmit} />;
}

⚙️ Configuration

The form is controlled through a configuration object.

type Config = {
  fields: {
    [key: string]: FieldConfig;
  };

  steps: string[][];

  validateOnNext: boolean;
};

📘 Form Props

| Prop | Type | Description | | -------- | -------- | ------------------------- | | config | Config | Form configuration object | | onSubmit | Function | Async submit handler |


🧩 Field Configuration

Example:

email: {
  type: FieldsTypes.Input,

  validateOn: "blur",

  validation: {
    required: {
      isRequired: true,
    },
  },
}

📚 Supported Field Types

FieldsTypes.Input;
FieldsTypes.Radio;
FieldsTypes.Date;

✅ Validation Rules

Required

required: {
  isRequired: true;
}

Length

length: {
  min: 8,
  max: 12,
}

Regular Expression

regExp: {
  reg: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
}

🔁 Multi-step Forms

Steps define which fields should be rendered together.

steps: [["email", "password"], ["gender"]];

When validateOnNext is enabled, the current step is validated before moving to the next step.

The form automatically provides:

  • Next button
  • Back button
  • Submit button on the final step

🌐 Server-side Validation

The library supports async submit handlers and server-side validation errors.

Example:

function handleSubmit(data: unknown) {
  return apiRequest(data);
}

Example server response:

{
  email: "Email already exists",
  password: "Password is too weak",
}

Server-side errors are automatically mapped back to corresponding form fields.


🏗 Architecture Highlights

This project demonstrates:

  • reusable React component architecture
  • config-driven UI design
  • custom validation engine
  • multi-step form state management
  • async form processing
  • TypeScript library development
  • Rollup-based package bundling
  • npm package publishing
  • unit testing with Jest

📁 Project Structure

src/
  components/
  hooks/
  utils/
  types.ts
  index.ts

🛠 Tech Stack

  • React
  • TypeScript
  • Rollup
  • Jest
  • React Testing Library

📦 npm Package

https://www.npmjs.com/package/@korytnikov_n/react-config-form


🔮 Possible Improvements

  • Checkbox support
  • Select component support
  • Textarea component support
  • Custom validation messages
  • Better styling customization
  • Storybook documentation
  • Additional unit tests
  • Schema validation adapters

📄 License

MIT