Website: forms.bridger.to
A powerful form builder built with Next.js, React, Tanstack Forms, and shadcn/ui. This project features a drag-and-drop form builder component and a shareable component registry for seamless reuse.
npx shadcn@latest add https://forms.bridger.to/r/form-builder.jsonThis automatically installs all dependencies including the inline-edit component.
- π¨ Visual Form Builder β Intuitive drag-and-drop UI for designing forms
- π Flexible Field Types β Text, email, phone, number, textarea, select, radio, checkbox, switch, slider, and more
- β Form Validation β Built-in validation powered by Zod schemas
- π― Component Registry β Easily install components via the shadcn CLI
- β‘ shadcn/ui Compatible β Built on top of shadcn/ui for great design and flexibility
- Node.js 18+
- pnpm (recommended), or npm/yarn
# Clone the repository git clone https://github.com/brijr/forms.git cd forms # Install dependencies pnpm install # Start the development server pnpm devVisit http://localhost:3000 to use the form builder.
This project provides a shadcn-compatible component registry for easy integration into other projects.
A click-to-edit component supporting both single-line and multiline inline editing.
Registry Dependencies: input, textarea
A fully-featured form builder with drag-and-drop, field validation, and form rendering.
Registry Dependencies: inline-edit, button, input, textarea, select, checkbox, radio-group, switch, slider, field, dialog, label, dropdown-menu, sidebar
NPM Dependencies: @dnd-kit/core, @dnd-kit/sortable, @dnd-kit/utilities, @tanstack/react-form, @tanstack/zod-form-adapter, zod, sonner, lucide-react
To generate the registry files:
pnpm run registry:buildThis command creates JSON bundles in public/r/ for use by the shadcn CLI.
Install the form builder (includes all dependencies):
npx shadcn@latest add https://forms.bridger.to/r/form-builder.jsonOr install just the inline-edit component:
npx shadcn@latest add https://forms.bridger.to/r/inline-edit.jsonnpx shadcn@latest add http://localhost:3000/r/form-builder.jsonNote: Components will be installed to components/forms/ directory. The inline-edit component will be installed to components/ui/inline-edit/.
After installation, you can use the FormBuilder component:
import { FormBuilder } from "@/components/form-builder"; export default function Page() { return <FormBuilder />; }The form builder includes JSON import/export utilities that can be used independently:
import { downloadFormConfig, parseFormConfig, type FormConfig } from "@/components/form-builder"; // Export a form configuration to JSON const formConfig: FormConfig = { id: "form_123", title: "My Form", fields: [...] }; downloadFormConfig(formConfig); // Downloads as JSON file // Parse and validate an imported form configuration const jsonString = `{"id": "form_123", "title": "My Form", "fields": []}`; const config = parseFormConfig(jsonString); if (config) { // Use the validated config console.log(config); }From @/components/form-builder:
Components:
FormBuilder- The main form builder componentFormRenderer- Component to render forms from configuration
Hooks:
useFormBuilder- Hook for form state management (fields, selection, view mode, CRUD operations)
Types:
FormConfig- Complete form configurationFieldConfig- Individual field configurationFieldType- Available field typesFieldOption- Options for select/radio/checkbox fieldsValidationRule- Validation rules for fieldsViewMode- Builder view modes ("builder"|"preview"|"json")
Utilities:
downloadFormConfig(formConfig)- Export form config as JSON fileparseFormConfig(jsonString)- Parse and validate JSON form configcreateDefaultField(type, index)- Create a field with defaultscreateEmptyForm()- Create an empty form configurationgenerateFormSchema(config)- Generate Zod schema for form validationgetDefaultValues(config)- Extract default values from configFIELD_TYPES- Array of available field type configurationsCATEGORIES- Field type categories for the toolbox
registry/ βββ inline-edit/ β βββ inline-edit.tsx βββ form-builder/ βββ lib/ β βββ form-config.ts β βββ form-utils.ts βββ field-editor.tsx βββ field-preview.tsx βββ field-toolbox.tsx βββ floating-controls.tsx βββ form-builder.tsx βββ form-renderer.tsx βββ index.ts βββ option-list.tsx βββ sortable-field.tsx βββ use-form-builder.ts Installation Structure: When installed via shadcn, everything goes into components/form-builder/:
components/ βββ form-builder/ β βββ lib/ β β βββ form-config.ts β β βββ form-utils.ts β βββ field-editor.tsx β βββ field-preview.tsx β βββ field-toolbox.tsx β βββ floating-controls.tsx β βββ form-builder.tsx β βββ form-renderer.tsx β βββ index.ts β βββ option-list.tsx β βββ sortable-field.tsx β βββ use-form-builder.ts βββ ui/ βββ inline-edit.tsx βββ app/ # Next.js app directory βββ components/ β βββ ui/ # shadcn/ui components βββ lib/ # Shared utilities βββ registry/ # Component registry (source of truth) β βββ form-builder/ # Form builder components β βββ inline-edit/ # Inline edit component βββ public/ β βββ r/ # Generated registry JSON files βββ registry.json # Registry entry point pnpm devβ Start development serverpnpm buildβ Build for productionpnpm startβ Run production serverpnpm lintβ Run ESLintpnpm registry:buildβ Build registry JSON files
MIT