form-builder Tailwind Templates

Form Builder

A dynamic and customizable form builder built with React, TypeScript, Zustand, and Tailwind CSS. Create, update, and manage form fields in real-time with ease.

๐Ÿงฑ Form Builder

A dynamic form builder built with React and TypeScript that allows users to create and manage custom form fields in real-time using a centralized state store.

๐Ÿš€ Features

  • โž• Add fields dynamically (text, number, textarea, date, etc.)
  • ๐Ÿ—‘๏ธ Remove or update individual fields
  • ๐Ÿ”„ Reset form with one click
  • ๐Ÿง  Centralized state management using useFormStore (e.g., Zustand)
  • ๐Ÿ“ฆ Component-based architecture
  • ๐ŸŽจ Styled with Tailwind CSS
  • ๐Ÿ” Type-safe using TypeScript

๐Ÿ›  Tech Stack

  • React (with Hooks)
  • TypeScript
  • Zustand or any state management via useFormStore
  • Tailwind CSS

๐Ÿ“ฆ Installation

git clone https://github.com/Kelsen23/react-form-builder.git
cd react-form-builder
npm install
npm run dev

๐Ÿงช How It Works

๐Ÿงฉ Adding a Field

The FormBuilder component manages a local newField state. Here's the process:

  1. User types a label (e.g., "Email").
  2. Selects a field type (e.g., text, number, date, etc.).
  3. Clicks the Add Field button.
  4. The field is added to the global store using addField() from useFormStore.

๐Ÿ›  Managing Fields

Each form field is rendered using the FormField component, which allows:

  • ๐Ÿ“ Inline editing: Users can modify the label, value, or type.
  • โ™ป๏ธ Updating: Changes trigger updateField(index, updatedField).
  • โŒ Removing: Clicking remove calls removeField(index).

๐Ÿ” Resetting the Form

  • Clicking the Reset Form button calls resetForm() from the store.
  • This clears all fields and resets the builder to its initial state.

๐Ÿค Contributing

PRs and suggestions are welcome! Open an issue or fork the project to get started.

๐Ÿ“œ License

MIT

Top categories

Loading Svelte Themes