BuzzForm
BuzzFormDocs

Introduction

BuzzForm is a schema-driven form library for React built on TanStack Form.

Introduction

BuzzForm is a schema-driven form library for React. Define your form as a plain object and BuzzForm handles rendering, validation, and conditional logic — with full TypeScript inference.

It ships as two packages:

  • @buildnbuzz/form-core — framework-agnostic types, validation, and utilities. No React, no DOM.
  • @buildnbuzz/form-react — React adapter built on TanStack Form. Provides useForm, <Form>, <FormProvider>, and field hooks.

The UI layer is delivered as a shadcn registry — install field components into your codebase and customize them freely.

Why BuzzForm?

Building forms in React is repetitive. You end up writing the same input wiring, validation logic, and conditional visibility code over and over. BuzzForm lets you declare your form structure once:

import { defineSchema, type InferType } from "@buildnbuzz/form-react";

const schema = defineSchema({
  fields: [
    { type: "text", name: "name", label: "Full Name", required: true },
    { type: "email", name: "email", label: "Email", required: true },
    {
      type: "password",
      name: "password",
      label: "Password",
      minLength: 8,
      criteria: { requireUppercase: true, requireNumber: true },
    },
  ],
});

type FormData = InferType<typeof schema.fields>;
// { name: string; email: string; password: string }

And get rendering, validation, and typed submission data automatically:

import {
  Form,
  FormContent,
  FormFields,
  FormSubmit,
} from "@/components/buzzform/form";

<Form schema={schema} onSubmit={({ value }) => console.log(value)}>
  <FormContent>
    <FormFields />
    <FormSubmit>Submit</FormSubmit>
  </FormContent>
</Form>;

Key Features

Schema-Driven

Define fields as data. One object is the source of truth for rendering, validation, and TypeScript types.

TanStack Form Core

Built on TanStack Form — battle-tested state management, async validation, and field-level subscriptions.

Declarative Conditions

Show, hide, disable, or require fields using a composable AST condition system. No imperative callbacks.

Built-in Validators

required, email, minLength, pattern, min, max, matches, passwordCriteria, and more — all declarative.

Dynamic Values

Reference other field values or external context in labels, placeholders, defaults, and validator args using $data and $context references.

Async Option Resolvers

Load select options from APIs with automatic dependency tracking, request deduplication, and cascading dropdown support.

Registry Pattern

Map field types to your own React components. Install shadcn field components via the CLI or bring your own.

TypeScript Inference

InferType gives you a fully typed form data object from your schema definition — no manual typing needed.

Quick Install

With shadcn/ui:

npx shadcn@latest add @buzzform/all

Headless / Custom UI:

pnpm add @buildnbuzz/form-react

For complete setup instructions including registry configuration, see Installation.

How It Works

  1. Install — add the core packages and field components via the shadcn registry
  2. Define a schema — create a FormSchema with a fields array using defineSchema()
  3. Wrap with provider — add <FormProvider registry={registry}> to your root layout
  4. Render — use <Form schema={schema}> with <FormContent>, <FormFields />, and <FormSubmit> — fields render automatically via your registry
  5. Handle submission — get fully typed data in your onSubmit callback
import { defineSchema, type InferType } from "@buildnbuzz/form-react";import { Form, FormContent, FormFields, FormSubmit } from "@/components/buzzform/form";import { toast } from "sonner";// 1. Define schemaconst schema = defineSchema({  fields: [    { type: "text", name: "name", label: "Full Name", required: true },    { type: "email", name: "email", label: "Email", required: true },    { type: "password", name: "password", label: "Password", minLength: 8 },  ],});// 2. Infer typetype FormData = InferType<typeof schema.fields>;// { name: string; email: string; password: string }// 3. Render formexport function SignUpForm() {  return (    <Form      schema={schema}      onSubmit={({ value }) => {        const data = value as FormData;        toast("Account created!", { description: data.email });      }}    >      <FormContent>        <FormFields />        <FormSubmit>Create Account</FormSubmit>      </FormContent>    </Form>  );}

On this page