{"data":{"prismicDocsCategory":{"data":{"pages":[{"page":{"uid":"what-is-uxpin-merge","document":[{"data":{"title":{"text":"What is UXPin Merge?"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"using-react.js-components","document":[{"data":{"title":{"text":"Using React.js Components"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"creating-a-library","document":[{"data":{"title":{"text":"Creating a Library"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"ai-assisted-merge-integration","document":[{"data":{"title":{"text":"AI-Assisted Merge Integration"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"start-with-a-boilerplate-repo","document":[{"data":{"title":{"text":"Start with a Boilerplate Repo"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"integrating-your-own-components","document":[{"data":{"title":{"text":"Integrating Your Own Components"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"config-file","document":[{"data":{"title":{"text":"Config File"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"webpack-configuration","document":[{"data":{"title":{"text":"Webpack Configuration"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"wrapper-component","document":[{"data":{"title":{"text":"Wrapper Component"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"adjusting-components","document":[{"data":{"title":{"text":"Adjusting Components"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"configuring-the-properties-panel","document":[{"data":{"title":{"text":"Configuring the Properties Panel"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"authoring-and-managing-jsx-presets","document":[{"data":{"title":{"text":"Authoring and Managing JSX Presets"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"cli-tool","document":[{"data":{"title":{"text":"CLI Tool"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"ci-servers","document":[{"data":{"title":{"text":"Connecting code to UXPin (CI & push)"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"version-control","document":[{"data":{"title":{"text":"Version Control"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"patterns","document":[{"data":{"title":{"text":"Patterns"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"tailwind-css-integration","document":[{"data":{"title":{"text":"Tailwind CSS Integration"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"merge-design-system-documentation","document":[{"data":{"title":{"text":"Merge Design System Documentation"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"merge-component-manager","document":[{"data":{"title":{"text":"Merge Component Manager"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"storybook-integration","document":[{"data":{"title":{"text":"Storybook integration"},"visible_in_table_of_content":"true"}}]}},{"page":{"uid":"merge-faq","document":[{"data":{"title":{"text":"Frequently Asked Questions"},"visible_in_table_of_content":"true"}}]}}]}},"prismicDocsPage":{"data":{"title":{"text":"Adjusting Components"},"isVisibleForRobots":"true","body":[{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Portal Components"},"content":{"html":"<p>When you need to display chosen components outside the UXPin canvas – at a specific position on the screen, Portal Components will enable that. </p><p>For example, notification components (often called “toast” or “snack”) are displayed at the top or the bottom of the screen. Another common pattern in web applications is “modal” (or “dialog”) components that cover the whole screen. To display these types of components correctly, you need to render them in what is called a <a target=\"_blank\" rel=\"noopener\" href=\"https://reactjs.org/docs/portals.html\">Portal</a> in the React world.</p><p>Use the JSDoc comment “@uxpinuseportal” to enable this behavior in the UXPin Preview mode:</p><p></p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinuseportal\n */\nfunction Dialog(props) {\n}"}]},"language":null}},{"__typename":"PrismicDocsPageBodyTip","slice_type":"tip","primary":{"tip_type":"Info tip","tip_title":null,"tip":{"html":"<p>Portal Components can be dropped anywhere in the canvas no matter their position on the canvas in the UXPin Editor.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Mark components by comment"},"content":{"html":"<p>Component properties are serialized based on the default export of class/function. If the export of a component is not a function/class that exposes its own props but is wrapped by another function, then the serialization is not possible.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"export default withAppProvider<Props>()(Button);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>In the Button component from the example above we cannot serialize properties (and finally can&#39;t display the Properties panel). To handle this approach, you have to add a JSDoc comment to handle this component.</p><h3></h3><p>A solution to the case above is to add a JSDoc comment @uxpincomponent before the class/function that declares the component.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpincomponent\n */\nexport class Button extends React.PureComponent {\n  // ...\n}"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>You have to add a `@uxpincomponent` comment before the class/function.</p>"}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Namespaced Components"},"content":{"html":"<p>You may use the nested components approach in your library. It means that your component contains another component. Use them as represented below:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"import Autocomplete from '../Autocomplete';\n \nconst textField = (\n  <Autocomplete.ComboBox.TextField\n    onChange={this.updateText}\n    label=\"Tags\"\n    value={this.state.inputText}\n    placeholder=\"Vintage, cotton, summer\"\n  />\n);\n \nexport default (\n  <Autocomplete\n    allowMultiple\n    textField={textField}\n    listTitle=\"Suggested Tags\"\n  />\n);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>There are 3 levels of components here:</p><ul><li>top-level component: `Autocomplete`</li><li>second-level component: `ComboBox`</li><li>third-level component: `TextField`</li></ul><p>To handle this approach you have to declare the namespace in your component.</p><h3>Declare namespaced components</h3><p>To declare the namespace in components, use the JSDoc comment `@uxpinnamespace`, and declare the name of the parent component. Looking back at our example, you need to declare the namespaces in `ComboBox` and `TextField` components like below:</p><p>`ComboBox.jsx`</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinnamespace Autocomplete\n */\nexport class ComboBox extends React.PureComponent {\n  // ...\n}"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>`TextField.jsx`</h3>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinnamespace Autocomplete.ComboBox\n */\nexport class TextField extends React.PureComponent {\n  // ...\n}"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>On our example, the namespace for the `ComboBox` component is `Autocomplete` because it&#39;s a direct child of the `Autocomplete` component. And the namespace for the `TextField` component is `Autocomplete.ComboBox` because it’s on the 3rd level from the top component (1st level), and its parent is the `ComboBox`. This is how we support multilevel nesting.</p><h3>Use namespaced components in preset</h3><p>After adding the `@uxpinnamespace` comment, you&#39;ll be able to use components in merge presets. You can do this the same way as in your application code.</p><p>When you import the Autocomplete component in preset by:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"import Autocomplete from '../Autocomplete';"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>You&#39;ll be able to use components to define preset like in your code:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"import Autocomplete from '../Autocomplete';\n \nconst textField = (\n  <Autocomplete.ComboBox.TextField\n    onChange={this.updateText}\n    label=\"Tags\"\n    value={this.state.inputText}\n    placeholder=\"Vintage, cotton, summer\"\n  />\n);\n \nexport default (\n  <Autocomplete\n    allowMultiple\n    textField={textField}\n    listTitle=\"Suggested Tags\"\n  />\n);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>You can also import the `TextField` component directly like below:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"import TextFiled from '../components/ComboBox/components/TextField';"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>Then you will create a preset like this:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"import Autocomplete from '../Autocomplete';\nimport TextFiled from '../components/ComboBox/components/TextField';\n \nconst textField = (\n  <TextField\n    onChange={this.updateText}\n    label=\"Tags\"\n    value={this.state.inputText}\n    placeholder=\"Vintage, cotton, summer\"\n  />\n);\n \nexport default (\n  <Autocomplete\n    allowMultiple\n    textField={textField}\n    listTitle=\"Suggested Tags\"\n  />\n);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Use namespaced components in JSX property</h3><p>The components declared in this way can be used in the properties panel as a value in node/element properties:</p>"}}},{"__typename":"PrismicDocsPageBodyImageWithCaption","slice_type":"image_with_caption","primary":{"image":{"url":"https://images.prismic.io/uxpincommunity/eb1e07dea7d132422c813d106666832381ca8269_props-panel.png?auto=compress,format","Retina__2x_":{"url":"https://images.prismic.io/uxpincommunity/5a53c049976257e3a2a85849315d93969e8fa389_props-panel.png?auto=compress,format"}},"image_description":{"text":null}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Namespaced components in Library</h3><p>Namespaced components in the library panel would display with a full namespace name:</p>"}}},{"__typename":"PrismicDocsPageBodyImageWithCaption","slice_type":"image_with_caption","primary":{"image":{"url":"https://images.prismic.io/uxpincommunity/7478a048d1247c04c1ffe41e3afba047cc35e130_library.png?auto=compress,format","Retina__2x_":{"url":"https://images.prismic.io/uxpincommunity/2cd8eb5c957dc3046ed8917c7a095e70108c39e8_library.png?auto=compress,format"}},"image_description":{"text":null}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Resizing Components"},"content":{"html":"<p>The presentation of code components in UXPin may require adjustments at times. That is especially important for the size of your code components.</p><p>Sometimes the bounding box of the code component may be larger than the element itself (<em>skip container</em>). </p><p>In other cases, you may want to block the possibility to resize the component (<em>non-resizable</em>). Or you may require to cover both at the same time.</p>"}}},{"__typename":"PrismicDocsPageBodyVideo","slice_type":"video","primary":{"video_link":{"url":"https://uxpincommunity.cdn.prismic.io/uxpincommunity%2F16ecec01-3093-4a3b-ba50-ff85f49328ca_wrapper.mp4"},"video_description":{"text":null}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":""},"content":{"html":"<h3>Use Cases</h3><p></p><h4>Skip container</h4><p>In some cases, the bounding box of the code component in UXPin can not match the real size of the element. To solve this problem you can point a specific HTML node (by default Merge uses root node of the component).</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"uxpinRef"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>This is a specific property that is passed to the component along with regular props. It must be set to React ref attribute, for example:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinwrappers\n * SkipContainerWrapper\n */\nconst Button = ({greeting='Hello', uxpinRef}) => (\n  <div>\n    <button className=\"btn\" ref={uxpinRef}>{greeting} 👋</button>\n  </div>\n);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h4>Non-resizable component</h4><p>Some code components aren’t resizable and you can mark this component as non-resizable to Merge. Thanks to this action we won’t see transformers to resize component in UXPin editor.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinwrappers\n * NonResizableWrapper\n */\nconst Button = ({greeting='Hello}) => (\n  <div>\n    <button className=\"btn\">{greeting} 👋</button>\n  </div>\n);"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Combined cases</h3><p>You can use both of the actions (and more in the future) for the same component.</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"/**\n * @uxpinwrappers\n * SkipContainerWrapper, NonResizableWrapper\n */"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":"Interaction triggered on property change"},"content":{"html":"<p>In many cases, the designer wants to get value from the prototype to update the content of the prototype. It means there needs to be a way to bind, store, and use values between components and UXPin.<br /><br />`@uxpinbind` allows you to bind the interaction to a specific property of the component. <br />In the editor, all properties <strong>that have a defined binding</strong> are available as interaction triggers for the selected code component.<br /><br />It allows the designer to:</p><ul><li>Trigger interactions based on the user&#39;s input</li><li>Get the value user provided and store it as property</li><li>Create conditional interactions </li></ul><p>Example of bound interaction:</p>"}}},{"__typename":"PrismicDocsPageBodyCode","slice_type":"code","primary":{"code":{"raw":[{"text":"Checkbox.propTypes = {\n  onChange: PropTypes.func,\n  /**\n   * @uxpinbind onChange 0.target.checked\n   */\n  isChecked: PropTypes.bool,\n}"}]},"language":"JavaScript"}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<h3>Example</h3><p></p><h4>Replace content based on the active tab using a `Tabs` component</h4><p>In Material UI (repository available here), there is a component named `Tabs`. It basically allows creating navigation based on tabs. This component contains other components as children - `Tab`. <br />As a designer, we may want to create an interaction to present specific content, let&#39;s say `Card` based on the selected `Tab`. UXPin won&#39;t be able by default to get the value of the selected tab from `Tabs` component. To do it, we&#39;ll use `@uxpinbind`<br /><br />The first step is to check the documentation of the component. <br />In this example, we&#39;ll bind two properties - `onChange` and `value`. The goal is to set an interaction in UXPin that will trigger interaction onChange once the value will be changed.<br /><br />The next step is to add `@uxpinbind` annotation to the value that will trigger interaction. `@uxpinbind` <strong>requires</strong> specific information about the parameter to bind the interaction.<br />For `Tabs` we want to use a value of the property and that&#39;s why we use the second parameter of the property `on Change 1`</p>"}}},{"__typename":"PrismicDocsPageBodyVideo","slice_type":"video","primary":{"video_link":{"url":"https://uxpincommunity.cdn.prismic.io/uxpincommunity/4351a33c-d5c4-45a7-986f-4175c74ab79d_add_bind.mp4"},"video_description":{"text":null}}},{"__typename":"PrismicDocsPageBodyContent","slice_type":"content","primary":{"content_title":{"text":null},"content":{"html":"<p>Once the `@uxpinbind` is defined designer can create an interaction using <strong>value<em> </em></strong>as a trigger for the interaction <strong>onChange<em>. </em></strong></p>"}}},{"__typename":"PrismicDocsPageBodyVideo","slice_type":"video","primary":{"video_link":{"url":"https://uxpincommunity.cdn.prismic.io/uxpincommunity/5aa0c407-054f-473a-852b-e5284984e292_bind.mp4"},"video_description":{"text":null}}}]}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"categoryUid":"merge","pageUid":"adjusting-components","meta_description":"UXPin's merge Docs, adjusting components for new and advanced users","meta_image":"https://images.prismic.io/uxpincommunity/fa3875f8df8606e6405ba46165becc1ea6ed3d34.png?auto=compress,format","meta_title":"Adjusting Components | Merge","page_title":"Adjusting Components | Merge"}}