The easiest way to contribute a new template is to build it visually first.
Build Visually:
Open the Visual Builder locally. Build your form (fields, steps, validation).
Export Configuration:
Use the developer tools or console to inspect the form state, or look at how useFormEditor saves the state. We are working on a "Export to JSON" feature for contributors.
Currently, you can manually create the template definition file based on your design.
Create Template File:
Create a new file in apps/web/src/registry/default/templates/ (e.g., medical-intake.ts).
import type { FormTemplate } from "../types";export const medicalIntake: FormTemplate = { id: "medical-intake", name: "Medical Intake", description: "Patient registration and medical history form.", category: "healthcare", // authentication | contact | ecommerce | profile fields: [ // ... your fields here ], // Auth is optional - only add if your template needs it // oauthProviders: [], // authPlugins: {},};
Register the Template:
Add it to apps/web/src/registry/default/templates/index.ts.
Build Registry:
Run pnpm --filter web registry:build to generate the artifacts.
Improving the Generator
If you want to improve the code generation logic:
For React Hook Form:
Edit files in apps/web/src/registry/default/lib/form-generator/generators/
Test your changes by running the visual builder and checking the "Code" tab
Run pnpm --filter web registry:build to update the generator artifacts
For TanStack Form:
Edit files in apps/web/src/registry/default/lib/form-generator/generators/tanstack/
Both generators should produce equivalent functionality
Adding a New Field Type
Add the field configuration to apps/web/src/lib/form-fields-config.ts
Update the generator to handle the new field type
Add the field to the form builder sidebar
Test in both RHF and TanStack Form modes
Code Style
TypeScript: All code must be type-safe
shadcn/ui: Use standard shadcn components
Accessibility: Ensure keyboard navigation and screen reader support
Comments: Add JSDoc for public APIs
Submitting Changes
Create a branch for your feature (git checkout -b feature/amazing-form)