Skip to content

virat-sr/React-Form-Hooks

Repository files navigation

React.Hook.Forms.mov

React Form Hooks Demo

A comprehensive demonstration of form handling in React using React Hook Form, TypeScript, and Vite. This project showcases various form controls, validation, and dynamic form elements with a focus on membership plan selection and add-ons.

Features

  • Form validation with React Hook Form
  • TypeScript integration
  • Dynamic dropdown menus
  • Checkbox groups for add-ons
  • Form state management
  • Development tools integration
  • Responsive styling
  • Reset functionality

Tech Stack

  • React 18.3
  • TypeScript
  • Vite
  • React Hook Form
  • @hookform/devtools
  • ESLint
  • SWC

Getting Started

  1. Clone the repository

  2. Install dependencies:

  3. Start the development server:

  4. Open your browser and navigate to http://localhost:5173

Form Features

Basic Form Fields

  • Username input with validation
  • Email input with pattern validation
  • Age input
  • Social media platform selection

Membership Plans

The form includes a dynamic membership plan selection system with:

  • Multiple plan options (Basic, Premium, Family)
  • Dynamic pricing display
  • Customizable add-ons and upgrades
  • Checkbox-based selection for components

Styling

The project includes a clean, responsive design with:

  • Centered layout
  • Consistent form control spacing
  • Error message styling
  • Checkbox group layouts
  • Dark/Light theme support

Development Tools

Available Scripts

Development Features

  • Hot Module Replacement (HMR)
  • React Hook Form DevTools integration
  • TypeScript type checking
  • ESLint configuration for React

Type Definitions

The project uses TypeScript interfaces for type safety:

  • FormValues: Defines the structure of form data
  • PricingDetail: Defines the structure of pricing components
  • ServicePlan: Defines the structure of service plans
  • Props: Defines component prop types

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is open source and available under the MIT License.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors