Skip to content

DataModel

This component generates a datamodel field to be used in the author dialog. The datamodel field’s value is passed to the component as a prop.

On AEM this will allow the author to select a content fragment.

Properties

PropertyTypeDescriptionDefault ValueRequired
labelstringThe label of the datamodel componentYes
placeholderstringPlaceholder text for the datamodel fieldNo
defaultValuestringDefault value for the datamodel componentNo
tooltipstringTooltip text for the datamodel fieldNo
requiredbooleanWhether the datamodel field is requiredfalseNo

Example

To use a datamodel component in the author dialog, we can use the following code:

{
datamodel: datamodel({
label: 'DataModel',
placeholder: 'Select a data model',
tooltip: 'Choose a structure from the CMS',
required: true,
})
}

Output Type

The Json of the data model is returned as a string.

type DataModelOutputType = Record<string, any>;

Example in author dialog

DataModel Component