This project is an Owner Registration Form built with React + TypeScript.
It showcases how to build reusable and type-safe form components along with polymorphic components for maximum flexibility.

- ✅ React + TypeScript for strong typing and better scalability
- ✅ Reusable form inputs (
Input,Select,CheckBox,TextArea) - ✅ Polymorphic
Boxcomponent – renders as different HTML elements (div,section, etc.) - ✅ Usage of
ComponentPropsWithoutReffor safer prop handling - ✅ Clean and modular project structure
👉 Registration Form – Live Demo
REGISTRATION-FORM/
│── public/
│── src/
│ ├── assets/ # Static assets (images, etc.)
│ ├── components/
│ │ ├── Form/
│ │ │ └── Form.tsx # Main form container
│ │ ├── FormsInputs/
│ │ │ ├── CheckBox.tsx # Reusable checkbox
│ │ │ ├── Input.tsx # Reusable input
│ │ │ ├── Select.tsx # Reusable select dropdown
│ │ │ └── TextArea.tsx # Reusable textarea
│ │ ├── Box.tsx # Polymorphic component (as="div" | "section" | ...)
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ └── MainFormSection.tsx
│ │
│ ├── Layout/
│ │ └── Layout.tsx # Layout wrapper for form
│ │
│ ├── data.ts # Static data (e.g., states, dropdown values)
│ ├── type.ts # Shared TypeScript types
│ ├── App.tsx # Root component
│ ├── main.tsx # Entry point
│ ├── index.css
│ └── App.css
│
│── package.json
│── tsconfig.json
│── README.md
- 🔹 Building reusable and type-safe form components with TypeScript
- 🔹 Creating a polymorphic component (
Box) to dynamically render different HTML elements - 🔹 Using
ComponentPropsWithoutRefto inherit props safely without extra boilerplate - 🔹 Organizing a React + TypeScript project with FormInputs and Layout separation
import React from "react";
import { ComponentPropsWithoutRef, ElementType } from "react";
type BoxProps<T extends ElementType> = {
as?: T;
} & ComponentPropsWithoutRef<T>;
export const Box = <T extends ElementType = "div">({
as,
...props
}: BoxProps<T>) => {
const Component = as || "div";
return <Component {...props} />;
};Usage:
<Box as="div" className="wrapper">Content inside div</Box>
<Box as="section" className="section">Content inside section</Box>git clone https://github.com/your-username/Owner-Registration-Form-React-TypeScript.git
cd Owner-Registration-Form-React-TypeScriptnpm install
# or
yarn installnpm run dev
# or
yarn dev