In this tutorial you will learn how to create and reuse custom elements in Studio Designer.
Requirements
- A Contract document type created in Studio Modeler
- The Web UI addon installed on your instance
Create an Element
We are going to start by adding a validation
schema to our Contract document type.
In Studio Modeler, in your go to Schema:
- Click on New and name it
validation
. - Add a field
validated
as a boolean. - Save your changes.
Go to the Studio Designer on the Resources tab.
- Create a folder called
elements
. - In it, create an element called
my-validation-element
. - Edit the layout of the element by adding the validation schema.
validated
field of the validation schema appears. - In the HTML editor, remove the lines describing the title and description.
- Expand the
validated
field and drag and drop the edit layout from the catalog to the editor. - Save your changes.
Reuse an Element
Now, go to your contract
document type, on the view layout to use your element:
- Click on Customize.
- On the search available in the elements catalog, search
my-validation-element
. - Drag and drop it from the catalog to the editor.
Save your changes and deploy your studio project, you're done :)
You can now reuse your element as much as you want, for example on the other layouts of your contract document, it will always be available in the Project Elements library.