Skip to content

Components

Dialogs

A dialog is the authoring form that exposes a component’s configurable properties to content authors. It is shown in the editing UI when an author edits a placed component, which is why it is also called the edit dialog. This page covers what a dialog is, how you define one for a component, and the field types available.

What a dialog is

Components store their authored settings as properties on the component’s content node. A dialog is the form that lets an author read and change those properties without editing content nodes by hand. Each field in the dialog is bound to a single property by name, so what the author types is written straight back to the component instance and picked up the next time the component renders.

A dialog is made of field nodes, one per editable property. Every field declares the property it writes to, a label shown to the author, and a field type that decides the input control (a text box, a checkbox, a picker, and so on). Only properties you surface through a field are editable in the UI; anything else stays fixed at whatever the component or its template sets.

Defining a dialog

A dialog is defined on the component itself, in an edit node under the component with a .content.xml. The root node is a dialog resource, it holds a single content container, and the field nodes live inside that container:

src/content/jcr_root/apps/<project>/components/<component>/edit/.content.xml

The root sets sling:resourceType="kestros/cms2/dialog". Each field sets sling:resourceType="kestros/cms2/fields/general/<type>" (or a Kestros picker type) and binds to a property with name=. Common field attributes are label, required, disabled, and focused (which auto-focuses the field when the dialog opens). Here is a minimal dialog with a single text field:

sample-component/edit/.content.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
          xmlns:kes="http://kestros.io/kes/1.0"
          jcr:primaryType="nt:unstructured"
          sling:resourceType="kestros/cms2/dialog">
    <content jcr:primaryType="nt:unstructured">
        <text jcr:primaryType="nt:unstructured"
              sling:resourceType="kestros/cms2/fields/general/textfield"
              name="sampleProperty"
              label="Sample Property"
              focused="{Boolean}true"/>
    </content>
</jcr:root>
A field’s name is the exact property it writes to. Match it to the property a component reads (for example the property behind a getSampleProperty() getter) so the authored value flows straight back into rendering.
Use the cms2 dialog shape. New dialogs should set sling:resourceType="kestros/cms2/dialog", as shown above. The older kestros/cms/dialog format used a different field vocabulary (fields addressed the property with propertyName= rather than name=). A running instance still carries both /libs/kestros/cms/* and /libs/kestros/cms2/*, but the cms2 shape is the supported one for new components.

Available field types

Fields fall into two groups: general fields for the common input controls, and Kestros-specific pickers that select platform resources such as components, datasources, layouts, themes, and variations.

General fields use sling:resourceType="kestros/cms2/fields/general/<type>":

Field typeresourceType suffixWhat it’s for
textfieldgeneral/textfieldSingle-line text input
textareageneral/textareaMulti-line text input
richtextgeneral/richtextRich-text (formatted) editor
numberfieldgeneral/numberfieldNumeric input
checkboxgeneral/checkboxSingle boolean checkbox
togglefieldgeneral/togglefieldOn/off toggle switch
selectfieldgeneral/selectfieldDropdown select from a list of options
radiogroupgeneral/radiogroupSingle choice from a set of radio options
multifieldgeneral/multifieldRepeatable group of fields (a list of entries)
pathfieldgeneral/pathfieldJCR path input / browser
tagfieldgeneral/tagfieldTag selection input
hiddenfieldgeneral/hiddenfieldNon-visible field carrying a fixed value
datefieldgeneral/datefieldDate input
timefieldgeneral/timefieldTime input
datetimefieldgeneral/datetimefieldCombined date and time input
datetimelocalfieldgeneral/datetimelocalfieldLocal (no-timezone) date and time input
dynamic-datasource-pathgeneral/dynamic-datasource-pathPath input driven by a datasource
dynamic-page-type-selectgeneral/dynamic-page-type-selectSelect populated with available page types
dynamic-route-handler-selectgeneral/dynamic-route-handler-selectSelect populated with available route handlers

Kestros-specific pickers use sling:resourceType="kestros/cms2/fields/kestros/<type>":

PickerresourceType suffixWhat it selects
component-pickerkestros/component-pickerA component
datasource-pickerkestros/datasource-pickerA datasource
layout-pickerkestros/layout-pickerA layout
theme-pickerkestros/theme-pickerA theme
variations-pickerkestros/variations-pickerComponent variations
These field types are the set registered under /libs/kestros/cms2/fields on a running 0.9.0 instance, so the list reflects the field set that ships with the platform. If a field type is missing on your instance, confirm what is registered under that path before relying on it.

For how dialogs fit into building a component end to end, see Custom Components. For the variations-picker and how variations are registered and applied, see Variations.