Model Definitions, Fields, and Component Types field-types
Learn about fields and the component types that the Universal Editor can edit in the properties panel with examples. Understand how you can instrument your own app by creating a model definition and linking to the component.
Overview overview
When adapting your own apps for use with the Universal Editor, you must instrument the components and define what fields and component types they can manipulate in the properties panel of the editor. You do this by creating a model and linking to that from the component.
This document provides an overview of a model definition and of fields and the component types available to you along with example configurations.
Model Definition Structure model-structure
In order to configure a component via the properties panel in the Universal Editor, a model definition has to exist and be linked to the component.
The model definition is a JSON structure, starting with an array of models.
[
{
"id": "model-id", // must be unique
"fields": [] // array of fields which shall be rendered in the properties panel
}
]
See the Fields section of this document for more information about how to define your fields array.
You can link a model to a component in two ways: using the component definition or via the instrumentation.
Linking Using the Component Definition component-definition
This is the preferred method of linking the model to the component. Doing so allows you to maintain the link centrally in the component definition and enables dragging components across containers.
Simply include the model property in the component object in the components array in the component-definition.json file.
For details, please see the document Component Definition.
Linking Using Instrumentation instrumentation
To use the model definition with a component, the data-aue-model attribute can be used.
<div data-aue-resource="urn:datasource:/content/path" data-aue-type="component" data-aue-model="model-id">Click me</div>
- Projects that have implemented the link to the model via the instrumentation will continue to work as-is with no need for change.
- If you define the model in the component definition as well as in the instrumentation, the instrumentation will always be used.
Loading a Model Definition loading-model
Once a model is created, it can be referenced as an external file.
<script type="application/vnd.adobe.aue.model+json" src="<url-of-model-definition>"></script>
Alternatively you can also define the model inline.
<script type="application/vnd.adobe.aue.model+json">
{ ... model definition ... }
</script>
Fields fields
A field object has the following type definition.
componentComponentTypelabelFieldLabeldescriptionFieldDescriptionvalueFieldValuevalue in the model definition. This ensures that what you see will match what is persisted in the backend.valueTypeValueTypestring, string[], number, date, booleanrequiredbooleanreadOnlybooleanhiddenbooleanmultibooleanNote that container nesting is not permitted for multi-fields in the properties panel
validationValidationTyperawunknown_) is not allowed in field names when using the aem or xwalk plugins.name Field and Nesting nesting
The name field can point directly to a property of the current resource, or in the case of components in cq:Pages, it can also use a path to a nested property. For example:
"name": "teaser/image/fileReference"
Component Types component-types
The following are the component types that are possible to use for rendering fields.
aem-tagaem-contentbooleancheckbox-groupcontaineraem-content-fragmentdate-timeaem-experience-fragmentmultiselectnumberradio-groupreferencerichtextselecttabtexttextareaAEM Tag aem-tag
An AEM tag component type enables an AEM tag picker, which can be used to attach tags to the component.
| code language-json |
|---|
|
AEM Content aem-content
An AEM content component type enables an AEM content picker, which can be used to select any AEM resource. Unlike the reference component, which can only select assets, the AEM content component can reference any AEM content. It offers an additional validation type.
rootPathstring| code language-json |
|---|
|
Boolean boolean
A boolean component type stores a simple true/false value rendered as a toggle. It offers an additional validation type.
customErrorMsgstring| code language-json |
|---|
|
| code language-json |
|---|
|
Checkbox Group checkbox-group
Similar to a boolean, a checkbox group component type allows for the selection of multiple true/false items, rendered as multiple checkboxes.
| code language-json |
|---|
|
Container container
A container component type allows the grouping of components including multifield support. It offers an additional configuration. Note that container nesting is not permitted for multi-fields in the properties panel
collapsibleboolean| code language-json |
|---|
|
| code language-json |
|---|
|
Content Fragment content-fragment
The Content Fragment picker can be used to select a Content Fragment and its variations (if required). It offers an additional configuration.
variationNamestringIt also offers an additional validation type.
rootPathstring| code language-json |
|---|
|
Date Time date-time
A date time component type allows the specification of a date, time, or combination thereof. It offers additional configurations.
displayFormatstringvalueFormatstringIt also offers an additional validation type.
customErrorMsgstringvalueFormat isn’t met| code language-json |
|---|
|
| code language-json |
|---|
|
Experience Fragment experience-fragment
The Experience Fragment picker can be used to select an Experience Fragment and its variations (if required). It offers an additional configuration.
variationNamestringIt also offers an additional validation type.
rootPathstring| code language-json |
|---|
|
Multiselect multiselect
A multiselect component type presents multiple items for selection in a drop-down including the ability to group the selectable elements.
| code language-json |
|---|
|
| code language-json |
|---|
|
Number number
A number component type allows for the input of a number. It offers additional validation types.
numberMinnumbernumberMaxnumbercustomErrorMsgstringnumberMin or numberMax isn’t met| code language-json |
|---|
|
| code language-json |
|---|
|
Radio Group radio-group
A radio group component type allows for a mutually-exclusive selection from multiple options rendered as a group similar to a checkbox group.
| code language-json |
|---|
|
Reference reference
An reference component type enables an AEM asset picker, which can be used to select any AEM asset to reference. Unlike the AEM content component, which can select any AEM resource, the reference component can only reference assets. It offers an additional validation type.
A reference component type allows for a reference to another data object from the current object.
| code language-json |
|---|
|
Rich Text rich-text
Rich text allows for multi-line, rich text input.
| code language-json |
|---|
|
Select select
A select component type allows for selection of a single option from a list of predefined options in a drop-down menu.
| code language-json |
|---|
|
Tab tab
A tab component type allows you to group other input fields together on multiple tabs to improve layout organization for the authors.
A tab definition can be thought of as a separator in the array of fields. Everything that comes after a tab will be placed on that tab until a new tab is encountered, whereafter the following items will be placed on the new tab.
If you wish to have items that appear above all tabs, they must be defined before any tabs.
| code language-json |
|---|
|
Text text
Text allows for a single line of text input. It includes additional validation types.
minLengthnumbermaxLengthnumberregExpstringcustomErrorMsgstringminLength, maxLength, and/or regExp is/are violated| code language-json |
|---|
|
| code language-json |
|---|
|
Text Area textarea
Text area allows for multiple lines of text input.
| code language-json |
|---|
|