Dynamic Form

This is a dynamic form that can be used to create any form. by passing array of objects to the dataFields prop.

Example :

test form1
description of the form goes here
test form
description of the form goes here 2
test form
description of the form goes here 3

How to use :

import DynamicForm from "@/components/dynamic-form";
const exampleData3: FormField[] = [
  {
    type: "email",
    name: "email",
    label: "Email",
    placeholder: "Email",
    error: "Email is required",
    width: 1,
    required: true,
  },
  {
    type: "password",
    name: "password",
    label: "Password",
    placeholder: "Password",
    error: "Password is required",
    width: 1,
  },
  {
    type: "action",
    name: "actions",
    buttons: [
      {
        label: "Submit",
        type: "submit",
        className: "w-full",
        variant: "secondary",
      },
    ],
    width: 1,
  },
];
<DynamicForm
  description="description of the form goes here"
  title="test form1"
  dataFields={Data}
/>;