Skip to main content

Form Builder Internals

The form builder uses Zustand for state management and a registry pattern for field rendering.

Architecture Overview

Zustand Store

Field Registry

Instead of a giant switch statement, we use a registry:

Adding a New Field Type

  1. Define the schema in src/types/schema.ts
  2. Create the renderer in src/components/engine/fields/
  3. Add to registry in src/components/engine/registry.tsx
  4. Add toolbox entry in src/components/form-builder/toolbox.tsx
  5. Add properties panel in src/components/form-builder/properties-panel.tsx
Example: Rating field

Schema Design

Form schema structure

Logic Engine

Conditional visibility