{"data":{"prismicDocsCategory":{"data":{"pages":[{"page":{"uid":"what-is-forge","document":[{"data":{"title":{"text":"What is Forge "},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"merge-react-library-ai","document":[{"data":{"title":{"text":"Forge with React libraries"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"ai-credits-models","document":[{"data":{"title":{"text":"AI Credits & Models "},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"faq","document":[{"data":{"title":{"text":"Frequently Asked Questions"},"visible_in_table_of_content":"true"}}]}}]}},"prismicDocsPage":{"data":{"title":{"text":"Forge with React libraries"},"isVisibleForRobots":"true","body":[{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>If you use UXPin Merge and have connected your own React component library, Forge can generate and edit UI using those same components.</p><p>Instead of generic elements, Forge builds <strong>real JSX</strong> using your exported React components and their props. This means the <strong>generated UI follows</strong> the <strong>same</strong> <strong>structure</strong> that <strong>exists</strong> <strong>in your codebase.</strong></p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Enabling AI support for your Merge library"},"content":{"html":"<p>To enable AI support for your component library:</p><ol><li>Add the following configuration to your library’s &quot;uxpin.config.js&quot; file under the settings field:</li></ol>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"const path = require('path');\nconst fs = require('fs');\n\nmodule.exports = {\n  components: './src/components/**/*.[jt]sx?(x)',\n\n  settings: {\n    useAI: {\n      name: \"Your Design System Name\",\n      documentationUrl: \"\",\n      systemPrompt: \"\",\n    },\n  },\n};"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>Push the updated &quot;uxpin.config.js&quot; file.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"npx uxpin-merge push --token=\"YOUR_TOKEN\""}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>After configuration, your library will appear in the <strong>Library pill</strong> in <a target=\"_blank\" rel=\"noopener\" href=\"https://www.uxpin.com/docs/forge\">Forge</a>.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Important notes</h3><ul><li>If the component library is private or proprietary, include detailed documentation or usage guidelines in &quot;systemPrompt&quot; so AI can generate correct code.</li><li>If &quot;documentationUrl&quot; is provided, it is included in the AI prompt as a reference.</li><li>&quot;systemPrompt&quot; can be used to define custom rules or override default JSX behavior.</li></ul>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>Additional spacing, typography, or visual rules can be defined in <a target=\"_blank\" rel=\"noopener\" href=\"https://www.uxpin.com/docs/forge/what-is-forge/#settings-customization\">Design System Guidelines.</a></p>"}}},{"__typename":"PrismicDocsPageBodyTip","slice_type":"tip","primary":{"tip_type":"Info tip","tip_title":"Note","tip":{"html":"<p>Your React component library must be connected through UXPin Merge.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Configuration options"},"content":{"html":"<p><strong>name</strong> (string)<br />Name of the component library for which the prompt should be generated.<br />Required. Default: empty string.</p><p><strong>documentationUrl</strong> (string)<br />URL to the component library&#39;s official documentation.<br />Optional. Default: empty string.</p><p><strong>systemPrompt</strong> (string)<br />Structured instructions that define how Forge should generate JSX.<br />Required. Default: empty string.</p><p></p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h4>How Forge uses your configuration</h4><p>When AI support is enabled:</p><ul><li>Forge generates JSX using components from your Merge library.</li><li>It follows rules defined in systemPrompt.</li><li>If rules are missing, the output may not match your internal standards.</li><li>Better documentation produces more consistent results.</li></ul>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Creating System Prompt"},"content":{"html":"<p>The &quot;systemPrompt&quot; defines how your components should be used during generation and editing.</p><p>For larger libraries, store the instructions in a separate file (SYSTEM_PROMPT.MD) and load it into &quot;uxpin.config.js&quot;.</p><p>Keeping instructions in a separate file makes them easier to maintain and version.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Structuring an effective systemPrompt</h3><p>The quality of generated JSX depends on how clearly your component rules are defined.</p><p>A structured &quot;systemPrompt&quot; should include:</p><ul><li>Library overview and purpose</li><li>Design principles</li><li>Critical usage patterns</li><li>Detailed component documentation (props, required fields, defaults)</li><li>Layout and spacing rules</li><li>Anti-patterns</li></ul><p>Define strict prop rules clearly.</p><p> </p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Example SYSTEM_PROMPT.MD template</h3><p>You can use the following structure as a starting point.<br />Replace the placeholder content with rules specific to your component library.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"``\n# System Prompt: JSX Code Generation for [Library Name]\n\nThis UXPin Merge library is a custom React component library for [purpose].\n\nBased on: [Framework name if applicable, e.g., Material UI, Ant Design]\n\nPhilosophy: [For custom libraries, describe design philosophy]\n\n---\n\n## DESIGN PRINCIPLES\n\n### Core Principles\n\nReplace this section with global rules that apply to all components.\n\n---\n\n## CRITICAL USAGE PATTERNS\n\nDocument your librarys most important conventions here using WRONG vs CORRECT examples in jsx code.\n\n### Pattern 1: [e.g., Text Props]\n\nWRONG:\n\n<Component wrongProp=\"value\">Text as children</Component>\n\nCORRECT:\n\n<Component textProp=\"value\" />\n\n### Pattern 2: [e.g., Icons]\n\nWRONG:\n\n<Button icon={<HomeIcon />} />\n\n\nCORRECT:\n\n<Button iconName=\"Home\" />\n\n---\n\n## COMPONENT DOCUMENTATION\n\n### ComponentName\n\nDescription: [Brief description of component purpose.]\n\n\nProps:\n\n- `propName` (type, required/optional, default) - Description\n\n- `anotherProp` (string | number, optional) - Description\n\n---\n\n## LAYOUT GUIDELINES\n\nDocument how to structure layouts using your library components.\n\n**Grid System:**\n\n<Row gutter={[16, 16]}>\n  <Col xs={24} md={12} lg={8}>\n    Content\n  </Col>\n</Row>\n\n\n**Spacing:**\n- Use 8px base unit for spacing\n- Maintain consistent margins: 8, 16, 24, 32, 48px\n- Container padding: 16px mobile, 24px tablet, 32px desktop\n---\n\n## ANTI-PATTERNS\n\nList patterns that must not be generated.  \n\n❌ DO NOT:\n\n- Use multiple primary buttons in the same view\n\n- Apply fixed widths that break responsiveness\n\n✅ DO:\n\n- Establish clear visual hierarchy\n\n- Use semantic HTML and proper component structure\n\n---\n\n## ICONS\n\nAvailable Icons: [List available icons]\n\nUsage: \n<Icon iconName=\"Search\" size=\"medium\" />\n<Button iconName=\"Plus\" label=\"Add Item\" />\n\n---\n\n## ADDITIONAL NOTES\n\n[Any other important information specific to your library]\n\n```"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":null}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Best Practices "},"content":{"html":"<h3>Define required props clearly</h3><p>If a prop is mandatory, state it clearly.</p><p>Example:</p><ul><li>label is required.</li><li>variant defaults to &quot;secondary&quot;.</li><li>Only one primary button per view.</li></ul><p>Avoid vague instructions such as &#39;Use buttons consistently.&#39;</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Define layout patterns</h3><p>If your system requires specific wrappers, containers, or grid rules, include them in &quot;systemPrompt&quot;.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>If spacing follows a fixed scale (for example, 8px increments), clearly define it.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Document anti-patterns</h3><p>State what should not be generated.</p><p>Example:</p><ul><li>Do not use inline styles.</li><li>Do not use multiple primary buttons.</li></ul><p>Constraints improve output predictability.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Keep rules inside systemPrompt for private libraries</h3><p>If your library is private or proprietary:</p><ul><li>Do not rely only on documentationUrl.</li><li>Include full usage conventions directly in &quot;systemPrompt&quot;</li></ul><p>External links are treated as reference.<br />Rules written inside the prompt have a stronger impact on the generated output.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Maintain and update the prompt</h3><p>Update &quot;SYSTEM_PROMPT.MD&quot; when:</p><ul><li>New components are added</li><li>Props change</li><li>Layout rules are updated</li><li>Design tokens are modified</li></ul><p>After each update, run <strong>uxpin-merge push</strong> to apply changes.</p>"}}}]}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"categoryUid":"forge","pageUid":"merge-react-library-ai","meta_description":"UXPin's forge Docs, forge with react libraries for new and advanced users","meta_image":"https://images.prismic.io/uxpincommunity%2F596562eb-7e0e-4ef3-a001-4d1baebd1ad3_og_uxpin_docs.png?auto=format,compress","meta_title":"Forge with React libraries | Forge","page_title":"Forge with React libraries | Forge"}}