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

gd-form-configurator-react

v0.0.12

Published

React adapter for form-configurator - schema-driven form builder

Readme

Form Configurator - React Adapter

React adapter for gd-form-configurator - a schema-driven form builder with built-in validation and state management.

Installation

npm install gd-form-configurator-react

This package includes the core library as a dependency, so you don't need to install gd-form-configurator separately.


Quick Start

import { FormBuilder } from 'gd-form-configurator-react';
import 'gd-form-configurator/styles';

function MyForm() {
  const schema = {
    type: 'object',
    properties: {
      name: { type: 'string', title: 'Name' },
      email: { type: 'string', format: 'email', title: 'Email' },
      age: { type: 'number', minimum: 18, title: 'Age' },
    },
    required: ['name', 'email'],
  };

  const uischema = {
    type: 'VerticalLayout',
    elements: [
      { type: 'Control', scope: '#/properties/name' },
      { type: 'Control', scope: '#/properties/email' },
      { type: 'Control', scope: '#/properties/age' },
    ],
  };

  const handleSubmit = (data) => {
    console.log('Form submitted:', data);
  };

  const handleChange = (data) => {
    console.log('Form data changed:', data);
  };

  return (
    <FormBuilder schema={schema} uischema={uischema} initialData={{}} onSubmit={handleSubmit} onChange={handleChange} />
  );
}

Features

  • Pre-built React Components: All standard HTML5 input types supported
  • Grid Dynamics UI Integration: Seamless integration with Grid Kit components
  • Automatic Control Selection: Intelligent control selection based on schema format
  • Custom Controls: Easy to add your own custom React components
  • Type Safe: Full TypeScript support
  • Hooks API: Access form state with React hooks

Built-in Controls

The React adapter includes ready-to-use controls for:

  • Text, Email, Password, URL, Tel
  • Number, Range
  • Date, Time
  • Select, Switch, Checkbox, Radio
  • Textarea, Color, File, Search
  • Arrays (with add/remove/reorder)

Controls are automatically selected based on your schema's type and format properties.


Custom Controls

Add your own custom React components:

import { FormBuilder } from 'gd-form-configurator-react';

const RatingControl = ({ value, onChange, label, errors }) => (
  <div>
    <label>{label}</label>
    <div>
      {[1, 2, 3, 4, 5].map((star) => (
        <button key={star} onClick={() => onChange(star)} style={{ color: value >= star ? 'gold' : 'gray' }}>
          ★
        </button>
      ))}
    </div>
    {errors.length > 0 && <span>{errors[0].message}</span>}
  </div>
);

const customControls = [
  {
    name: 'rating',
    renderer: RatingControl,
  },
];

function MyForm() {
  const uischema = {
    type: 'VerticalLayout',
    elements: [
      {
        type: 'Control',
        scope: '#/properties/rating',
        options: { custom: 'rating' }, // Activate custom control
      },
    ],
  };

  return <FormBuilder schema={schema} uischema={uischema} initialData={{}} customControls={customControls} />;
}

Hooks API

Access form state directly in your components:

import { FormBuilder, useFormEngine, useFormStore } from 'gd-form-configurator-react';

function FormActions() {
  const engine = useFormEngine();
  const { data, errors } = useFormStore((state) => ({
    data: state.data,
    errors: state.errors,
  }));

  const handleValidate = () => {
    const validationErrors = engine.validate();
    if (validationErrors.length === 0) {
      console.log('Form is valid!');
    }
  };

  const handleReset = () => {
    engine.resetToEmpty();
  };

  return (
    <div>
      <button onClick={handleValidate}>Validate</button>
      <button onClick={handleReset}>Reset</button>
      <div>Errors: {errors.length}</div>
    </div>
  );
}

function App() {
  return (
    <FormBuilder schema={schema} uischema={uischema} initialData={{}}>
      <FormActions />
    </FormBuilder>
  );
}

Logging

The React adapter supports logging through the logger prop.

Using a Custom Logger

import { FormBuilder, ILogger } from 'gd-form-configurator-react';

const myLogger: ILogger = {
  debug: (msg, ...meta) => console.debug(msg, ...meta),
  info: (msg, ...meta) => console.info(msg, ...meta),
  warn: (msg, ...meta) => console.warn(msg, ...meta),
  error: (msg, ...meta) => console.error(msg, ...meta),
};

function MyForm() {
  return (
    <FormBuilder
      schema={schema}
      uischema={uischema}
      initialData={{}}
      logger={myLogger}
      onSubmit={handleSubmit}
    />
  );
}

What Gets Logged

  • Error: Form initialization failures, renderer not found, array operation errors
  • Warn: Validation warnings, UISchema issues
  • Info: Form initialization, validation completion, schema updates
  • Debug: Field updates, re-renders, rule evaluations

Silent Mode (Default)

If no logger is provided, the form operates silently without logging:

// No logger - silent operation (default)
<FormBuilder schema={schema} uischema={uischema} initialData={{}} />

FormBuilder Props

interface FormBuilderProps {
  schema: DataSchema; // JSON Schema definition
  uischema: UISchema; // UI Schema for layout
  initialData: any; // Initial form data
  customControls?: CustomControl[]; // Custom React components
  onChange?: (data: any) => void; // Called on data change
  onSubmit?: (data: any) => void; // Called on valid form submit
  children?: React.ReactNode; // Additional content
  logger?: ILogger; // Optional logger instance
}

Peer Dependencies

This package requires:

  • react ^18.0.0 || ^19.0.0
  • react-dom ^18.0.0 || ^19.0.0

Core Library Documentation

For complete documentation on schemas, validation, conditional logic, and advanced features, see the core library documentation.


License

MIT License - see LICENSE file for details


Links