| <!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>installation | react-declarative</title><meta name="description" content="Documentation for react-declarative"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">react-declarative</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">react-declarative</a></li><li><a href="installation.html">installation</a></li></ul></div><div class="tsd-panel tsd-typography"><a id="installing-react-declarative-in-your-project" class="tsd-anchor"></a><h1 class="tsd-anchor-link">Installing react-declarative in your project<a href="#installing-react-declarative-in-your-project" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h1><p>react-declarative builds on top of Material UI (MUI) v5, so you install both the library and its required peer dependencies together. This page covers the three installation paths: a fresh project, an existing project, and a lightweight variant for apps that only need forms.</p> |
| <a id="full-installation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Full installation<a href="#full-installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Install react-declarative alongside MUI v5 and its required styling packages:</p> |
| <p><strong>npm</strong></p> |
| <pre><code class="bash"><span class="hl-5">npm</span><span class="hl-1"> </span><span class="hl-3">install</span><span class="hl-1"> </span><span class="hl-4">--save</span><span class="hl-1"> </span><span class="hl-3">react-declarative</span><span class="hl-1"> </span><span class="hl-3">tss-react</span><span class="hl-1"> </span><span class="hl-3">@mui/material</span><span class="hl-1"> </span><span class="hl-3">@emotion/react</span><span class="hl-1"> </span><span class="hl-3">@emotion/styled</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <p><strong>yarn</strong></p> |
| <pre><code class="bash"><span class="hl-5">yarn</span><span class="hl-1"> </span><span class="hl-3">add</span><span class="hl-1"> </span><span class="hl-3">react-declarative</span><span class="hl-1"> </span><span class="hl-3">tss-react</span><span class="hl-1"> </span><span class="hl-3">@mui/material</span><span class="hl-1"> </span><span class="hl-3">@emotion/react</span><span class="hl-1"> </span><span class="hl-3">@emotion/styled</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <blockquote> |
| <p><strong>Note:</strong> react-declarative requires <strong>MUI v5</strong> (<code>@mui/material ^5.5.0</code>). It is not compatible with MUI v4 or v6. The <code>tss-react</code> package is a required peer dependency used for component-level styling.</p> |
| </blockquote> |
| <a id="peer-dependencies-explained" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Peer dependencies explained<a href="#peer-dependencies-explained" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><table> |
| <thead> |
| <tr> |
| <th>Package</th> |
| <th>Why it's needed</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code>@mui/material</code></td> |
| <td>Provides all the base UI components (inputs, buttons, dialogs)</td> |
| </tr> |
| <tr> |
| <td><code>@emotion/react</code> + <code>@emotion/styled</code></td> |
| <td>MUI's CSS-in-JS engine; required for any MUI v5 project</td> |
| </tr> |
| <tr> |
| <td><code>tss-react</code></td> |
| <td>Used by react-declarative internally for scoped styles</td> |
| </tr> |
| </tbody> |
| </table> |
| <a id="scaffold-a-new-app-with-the-cra-template" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Scaffold a new app with the CRA template<a href="#scaffold-a-new-app-with-the-cra-template" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>If you are starting a new project from scratch, the quickest path is the official <code>create-react-app</code> template. It sets up React, TypeScript, MUI, and react-declarative in one command:</p> |
| <p><strong>yarn create</strong></p> |
| <pre><code class="bash"><span class="hl-5">yarn</span><span class="hl-1"> </span><span class="hl-3">create</span><span class="hl-1"> </span><span class="hl-3">react-app</span><span class="hl-1"> </span><span class="hl-4">--template</span><span class="hl-1"> </span><span class="hl-3">cra-template-react-declarative</span><span class="hl-1"> </span><span class="hl-3">.</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <p><strong>npx</strong></p> |
| <pre><code class="bash"><span class="hl-5">npx</span><span class="hl-1"> </span><span class="hl-3">create-react-app</span><span class="hl-1"> </span><span class="hl-3">.</span><span class="hl-1"> </span><span class="hl-4">--template=react-declarative</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <p>The template repository is at <a href="https://github.com/react-declarative/cra-template-react-declarative">github.com/react-declarative/cra-template-react-declarative</a>.</p> |
| <a id="lite-version-for-existing-apps" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Lite version for existing apps<a href="#lite-version-for-existing-apps" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>If you already have an app with its own MUI setup and only need the <code><One /></code> form component, install the lightweight variant instead. It carries a smaller dependency footprint:</p> |
| <pre><code class="bash"><span class="hl-5">npm</span><span class="hl-1"> </span><span class="hl-3">install</span><span class="hl-1"> </span><span class="hl-4">--save</span><span class="hl-1"> </span><span class="hl-3">react-declarative-lite</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <blockquote> |
| <p><strong>Tip:</strong> Use <code>react-declarative-lite</code> when you want to embed forms into an existing application without pulling in the full framework (data grid, scaffold, kanban, wizard, etc.). The API for <code><One /></code> and <code>TypedField</code> is identical between the full and lite packages.</p> |
| </blockquote> |
| <a id="typescript" class="tsd-anchor"></a><h2 class="tsd-anchor-link">TypeScript<a href="#typescript" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>react-declarative is written in TypeScript and ships full type definitions. No <code>@types/</code> package is needed. Your IDE will provide IntelliSense for all schema types, component props, and hook return values out of the box.</p> |
| <a id="verify-the-installation" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Verify the installation<a href="#verify-the-installation" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>After installing, import the core exports to confirm everything resolves correctly:</p> |
| <pre><code class="tsx"><span class="hl-0">import</span><span class="hl-1"> { </span><span class="hl-2">One</span><span class="hl-1">, </span><span class="hl-2">TypedField</span><span class="hl-1">, </span><span class="hl-2">FieldType</span><span class="hl-1"> } </span><span class="hl-0">from</span><span class="hl-1"> </span><span class="hl-3">'react-declarative'</span><span class="hl-1">;</span><br/><br/><span class="hl-2">console</span><span class="hl-1">.</span><span class="hl-5">log</span><span class="hl-1">(</span><span class="hl-2">FieldType</span><span class="hl-1">.</span><span class="hl-2">Text</span><span class="hl-1">); </span><span class="hl-17">// 'text'</span> |
| </code><button type="button">Copy</button></pre> |
|
|
| <a id="next-steps" class="tsd-anchor"></a><h2 class="tsd-anchor-link">Next steps<a href="#next-steps" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h2><p>Once installation is complete, follow the <a href="quickstart.html">quick start guide</a> to build your first form.</p> |
| </div></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><a href="#installing-react-declarative-in-your-project"><span>Installing react-<wbr/>declarative in your project</span></a><ul><li><a href="#full-installation"><span>Full installation</span></a></li><li><ul><li><a href="#peer-dependencies-explained"><span>Peer dependencies explained</span></a></li></ul></li><li><a href="#scaffold-a-new-app-with-the-cra-template"><span>Scaffold a new app with the CRA template</span></a></li><li><a href="#lite-version-for-existing-apps"><span>Lite version for existing apps</span></a></li><li><a href="#typescript"><span>Type<wbr/>Script</span></a></li><li><a href="#verify-the-installation"><span>Verify the installation</span></a></li><li><a href="#next-steps"><span>Next steps</span></a></li></ul></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">react-declarative</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html> |
|
|