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 🙏

© 2025 – Pkg Stats / Ryan Hefner

autoforma

v1.1.5

Published

AutoForma is a dynamic form builder based on Mantine and React

Readme

🚀 Introduction

AutoForma is a modern, dynamic, and extensible form builder for React — built on top of Mantine and fully written in TypeScript.
It allows you to create powerful forms entirely from JSON schema definitions, removing repetitive boilerplate code and giving you full control over field behavior and layout.

With AutoForma, you can:

  • 🧩 Define forms using schema objects — no manual wiring.
  • 🪄 Dynamically show, hide, or disable fields based on other values.
  • 🎨 Customize the UI with your own field renderers.
  • 🧠 Extend with new field types or layouts effortlessly.

💡 AutoForma is perfect for dashboards, admin panels, and SaaS apps where flexibility and maintainability matter.


📦 Installation

Install AutoForma along with its required Mantine and React peer dependencies:

npm install autoforma   @mantine/core@^8.3.2   @mantine/hooks@^8.3.2   @mantine/form@^8.3.2   @mantine/dates@^8.3.2   @mantine/tiptap@^8.3.2   @tiptap/react@^3.6.6   react@^19.0.0   react-dom@^19.0.0

⚙️ Setup Requirements

Before using AutoForma, wrap your app with the MantineProvider
and import Mantine’s global styles and optional TipTap editor styles:

import { MantineProvider } from "@mantine/core";
import "@mantine/core/styles.css";
import "@mantine/dates/styles.css";
import "@mantine/tiptap/styles.css";

const Root = () => (
  <MantineProvider>
    <App />
  </MantineProvider>
);

⚠️ Without wrapping your app in MantineProvider,
the components may not render or style correctly.


🧩 Basic Usage

Here’s a quick example of how you can generate a complete form instantly using AutoForma.
Just define your schema and pass it to the AutoForm component — it handles layout, validation, and submission automatically.

import AutoForm from "autoforma";
import { userFormSchema } from "./schema";

const App = () => (
  <AutoForm
    schema={userFormSchema}
    onSubmit={(values) => console.log("Submitted:", values)}
  />
);

✅ AutoForma automatically generates labels, validation, and layouts based on your schema.


🎨 Customization & Field Types

AutoForma gives you full control over how your form behaves and looks.
You can dynamically update field properties (like visibility, enabled state, or placeholder)
and even inject your own custom field types using customFieldTypes.


🧠 Supported Field Types

Out of the box, AutoForma supports a rich set of field types:

| Type | Description | |------|--------------| | text | Standard text input | | number | Numeric input | | select | Dropdown list | | checkbox | Boolean checkbox | | date | Date picker | | datetime | Combined date & time picker | | time | Time-only picker | | object | Nested object field (grouped sub-fields) | | array | Repeating array of fields | | switch | Toggle switch | | texteditor | Rich text editor (TipTap powered) | | tags | Multi-value tag input | | TCustom | Any custom type you define via customFieldTypes |

You can define your own type like this:

<AutoForm
  schema={schema}
  customFieldTypes={{
    colorPicker: (field, form) => (
      <input
        type="color"
        {...form.getInputProps(field.name)}
      />
    ),
  }}
/>

⚙️ API Reference

AutoForma exposes several TypeScript interfaces and configuration objects that make it fully type-safe and flexible.
Below are the main types you can use to configure and extend the library.

🧩 AutoFormProps<TValues>

The main props accepted by the AutoForm component.

export type AutoFormProps<
  TValues extends Record<string, any> = Record<string, any>
> = CustomRenderersConfig<TValues> & {
  schema: (FieldSchema<TValues> & Record<string, any>)[];

  initialValues?: ValueProvider<TValues>;
  currentValues?: ValueProvider<TValues>;

  prepareValues?: (values: TValues) => TValues | Promise<TValues>;
  onSubmit: (values: TValues) => void | Promise<void>;
  afterSubmit?: (values: TValues) => void | Promise<void>;

  validate?: FormValidateInput<TValues>;
  readOnly?: boolean;

  onFieldChange?: OnFieldChangeMap<TValues>;

  layout?: "vertical" | "horizontal" | "grid";

  updateFieldSchema?: UpdateFieldSchemaMap<TValues>;

  submitButton?: boolean | React.ReactNode;

  loading?: boolean;
};

🧠 Description of Properties

| Prop | Type | Description | |------|------|--------------| | schema | FieldSchema[] | The main schema defining all form fields. | | initialValues | ValueProvider<TValues> | Function or object returning the initial form values (called once). | | currentValues | ValueProvider<TValues> | Function or object providing current values (reactively updated). | | prepareValues | (values) => TValues \| Promise<TValues> | Modify or sanitize values before submit. | | onSubmit | (values) => void \| Promise<void> | Called when the form is submitted. | | afterSubmit | (values) => void \| Promise<void> | Called after successful submission (for side effects). | | validate | FormValidateInput<TValues> | Mantine validation config or validation schema. | | readOnly | boolean | Makes the entire form read-only. | | onFieldChange | OnFieldChangeMap<TValues> | Map of field-specific change handlers. | | layout | "vertical" \| "horizontal" \| "grid" | Form layout type. | | updateFieldSchema | UpdateFieldSchemaMap<TValues> | Dynamically modify schema based on values. | | submitButton | boolean \| ReactNode | Whether to render or customize the submit button. | | loading | boolean | Display a global loading state for the form. |


🧩 CustomRenderersConfig<TValues>

Defines all the ways you can override the default rendering logic.

export type CustomRenderersConfig<
  TValues extends Record<string, any> = Record<string, any>
> = {
  customFieldRenderers?: Record<
    string,
    (
      field: FieldSchema<TValues>,
      form: UseFormReturnType<TValues>
    ) => React.ReactNode
  >;
  customTypeRenderers?: Record<
    string,
    (
      field: FieldSchema<TValues>,
      form: UseFormReturnType<TValues>
    ) => React.ReactNode
  >;
  customFieldTypes?: Record<
    string,
    (
      field: FieldSchema<TValues>,
      form: UseFormReturnType<TValues>
    ) => React.ReactNode
  >;
};

🧠 Description of Properties

| Prop | Type | Description | |------|------|--------------| | customFieldRenderers | Record<string, (field, form) => ReactNode> | Override rendering for specific field names. | | customTypeRenderers | Record<string, (field, form) => ReactNode> | Override rendering for specific field types (like select, text, etc.). | | customFieldTypes | Record<string, (field, form) => ReactNode> | Register completely new custom field types. |