{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "array-field-form",
  "title": "Array Field Form",
  "description": "Dynamic team members and milestones with drag-and-drop reordering.",
  "registryDependencies": [
    "@buzzform/array",
    "@buzzform/text",
    "@buzzform/email",
    "@buzzform/textarea",
    "@buzzform/select",
    "@buzzform/date",
    "@buzzform/tags",
    "@buzzform/row",
    "card",
    "sonner"
  ],
  "files": [
    {
      "path": "registry/shadcn/examples/array-field-form.tsx",
      "content": "\"use client\";\n\nimport { toast } from \"sonner\";\nimport { defineSchema, type InferType } from \"@buildnbuzz/form-react\";\nimport {\n  Form,\n  FormContent,\n  FormFields,\n  FormSubmit,\n  FormReset,\n  FormActions,\n} from \"@/registry/shadcn/form\";\nimport {\n  Card,\n  CardContent,\n  CardDescription,\n  CardHeader,\n  CardTitle,\n} from \"@/components/ui/card\";\n\n// Schema with array field for managing team members\nconst teamSchema = defineSchema({\n  fields: [\n    {\n      type: \"text\",\n      name: \"projectName\",\n      label: \"Project Name\",\n      placeholder: \"My Awesome Project\",\n      required: true,\n    },\n    {\n      type: \"textarea\",\n      name: \"projectDescription\",\n      label: \"Project Description\",\n      placeholder: \"Describe your project...\",\n      ui: { rows: 3 },\n    },\n    {\n      type: \"array\",\n      name: \"teamMembers\",\n      label: \"Team Members\",\n      description: \"Add team members who will work on this project\",\n      minItems: 1,\n      maxItems: 10,\n      ui: {\n        isSortable: true,\n        addLabel: \"Add Team Member\",\n      },\n      fields: [\n        {\n          type: \"row\",\n          ui: { gap: 16, responsive: true },\n          fields: [\n            {\n              type: \"text\",\n              name: \"name\",\n              label: \"Name\",\n              placeholder: \"John Doe\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"email\",\n              name: \"email\",\n              label: \"Email\",\n              placeholder: \"john@example.com\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n        {\n          type: \"row\",\n          ui: { gap: 16, responsive: true },\n          fields: [\n            {\n              type: \"select\",\n              name: \"role\",\n              label: \"Role\",\n              options: [\n                { label: \"Developer\", value: \"developer\" },\n                { label: \"Designer\", value: \"designer\" },\n                { label: \"Product Manager\", value: \"pm\" },\n                { label: \"QA Engineer\", value: \"qa\" },\n                { label: \"DevOps\", value: \"devops\" },\n              ],\n              required: true,\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"select\",\n              name: \"experience\",\n              label: \"Experience Level\",\n              options: [\n                { label: \"Junior (0-2 years)\", value: \"junior\" },\n                { label: \"Mid-level (2-5 years)\", value: \"mid\" },\n                { label: \"Senior (5+ years)\", value: \"senior\" },\n                { label: \"Lead/Principal\", value: \"lead\" },\n              ],\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n        {\n          type: \"tags\",\n          name: \"skills\",\n          label: \"Skills\",\n          placeholder: \"Add skills...\",\n          maxTags: 8,\n          ui: {\n            delimiters: [\"enter\", \"comma\"],\n            variant: \"pills\",\n          },\n        },\n      ],\n    },\n    {\n      type: \"array\",\n      name: \"milestones\",\n      label: \"Project Milestones\",\n      minItems: 2,\n      maxItems: 8,\n      ui: {\n        isSortable: true,\n        addLabel: \"Add Milestone\",\n      },\n      fields: [\n        {\n          type: \"text\",\n          name: \"title\",\n          label: \"Milestone Title\",\n          placeholder: \"MVP Launch\",\n          required: true,\n        },\n        {\n          type: \"row\",\n          ui: { gap: 16, responsive: true },\n          fields: [\n            {\n              type: \"date\",\n              name: \"dueDate\",\n              label: \"Due Date\",\n              required: true,\n              ui: { width: \"50%\" },\n            },\n            {\n              type: \"select\",\n              name: \"priority\",\n              label: \"Priority\",\n              options: [\n                { label: \"Low\", value: \"low\" },\n                { label: \"Medium\", value: \"medium\" },\n                { label: \"High\", value: \"high\" },\n                { label: \"Critical\", value: \"critical\" },\n              ],\n              ui: { width: \"50%\" },\n            },\n          ],\n        },\n        {\n          type: \"textarea\",\n          name: \"description\",\n          label: \"Description\",\n          placeholder: \"Describe the milestone...\",\n          ui: { rows: 2 },\n        },\n      ],\n    },\n  ],\n});\n\ntype TeamSchema = InferType<typeof teamSchema.fields>;\n\nexport default function ArrayFieldExample() {\n  const handleSubmit = async ({ value }: { value: unknown }) => {\n    const data = value as TeamSchema;\n    await new Promise((r) => setTimeout(r, 1000));\n    toast(\"Project created!\", {\n      description: (\n        <pre className=\"mt-2 max-h-48 overflow-auto rounded-md bg-muted text-muted-foreground p-3 text-xs\">\n          <code>{JSON.stringify(data, null, 2)}</code>\n        </pre>\n      ),\n    });\n  };\n\n  return (\n    <Card>\n      <CardHeader>\n        <CardTitle>Project Setup</CardTitle>\n        <CardDescription>\n          Dynamic team members and milestones with drag-and-drop reordering\n        </CardDescription>\n      </CardHeader>\n      <CardContent>\n        <Form\n          schema={teamSchema}\n          onSubmit={handleSubmit}\n          defaultValues={{\n            projectName: \"New Web App\",\n            teamMembers: [\n              {\n                name: \"Alice Johnson\",\n                email: \"alice@example.com\",\n                role: \"developer\",\n                experience: \"senior\",\n                skills: [\"React\", \"TypeScript\"],\n              },\n            ],\n            milestones: [\n              {\n                title: \"Project Kickoff\",\n                dueDate: new Date(),\n                priority: \"high\",\n                description: \"Initial planning and requirements gathering\",\n              },\n            ],\n          }}\n        >\n          <FormContent>\n            <FormFields />\n            <FormActions>\n              <FormReset>Reset</FormReset>\n              <FormSubmit>Create Project</FormSubmit>\n            </FormActions>\n          </FormContent>\n        </Form>\n      </CardContent>\n    </Card>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/buzzform/examples/array-field-form.tsx"
    }
  ],
  "type": "registry:block"
}