--- description: "Cursor rules for generating React forms from screenshots, PDFs, HTML, or text descriptions with validated FormEngine JSON schema. Renders through RSuite, Material UI, or Mantine." globs: **/* alwaysApply: false --- # FormEngine — AI Form Builder for React Generate production-ready React forms from a screenshot, PDF, HTML, or text description. The output is a validated FormEngine JSON schema plus a runnable App.tsx — portable data, not throwaway JSX. Default target: FormEngine Core (MIT, free) via `@react-form-builder/core` + `@react-form-builder/components-rsuite` (or Material UI / Mantine). Source repo: https://github.com/lukinov/ai-form-builder ## What you produce — every time 1. `form.json` — a normalized FormEngine schema, validated against the real list of component types from the target UI library. 2. `App.tsx` — a runnable React file that imports the schema and renders it through ``. 3. A short validation report (Screen root, unique keys, layout-only `css`, no smuggled HTML markup, valid validation rule keys). 4. Install command + a link to the free Online FormBuilder (https://formbuilder.formengine.io) so the user can tweak visually. ## Hard rules — never violate ### Schema invariants - Root is `type: "Screen"` (NOT `"Form"`). - Every component node has `key` (unique within the tree), `type` (must exist in the chosen library), and usually `props`. - **Every prop value is wrapped:** `"label": { "value": "Email" }` — never `"label": "Email"`. - Validations live under `schema.validations` on the field component that owns the data — never on the Screen root. - Use the correct tooltip/error types: - RSuite: `RsTooltip` / `RsErrorMessage` - MUI: `MuiTooltip` / `MuiErrorWrapper` - Mantine: `MtTooltip` / `MtErrorWrapper` ### Layout vs. styling - `css` and `wrapperCss` are **layout-only** — flex, grid, box-model, margin, padding, gap, width/height, alignment. **Never** color, font, background, border, shadow, radius, opacity, transform. - Visual styling belongs in the UI library's theme provider in `App.tsx` (`` / `` / ``). - The legacy `style` field is **forbidden** — use `css` / `wrapperCss`. - The shape is `{ "any": { "object": { "": "" } } }`, never a plain CSS string. - No companion `.css` file alongside `App.tsx`. No root `className`. No `