Creating a Property Editor
A guide to creating a property editor in Umbraco.
Overview
This guide covers setting up a Property Editor and registering it as a Data Type in Umbraco
The steps covered in part one are:
This tutorial uses TypeScript and Lit. Make sure your package is already set up before continuing.
o set up an extension using TypeScript and Lit, see the Creating your first extension article.
Resources
This tutorial will not go in-depth on how TypeScript and Lit work. To learn about TypeScript and Lit, you can find their documentation below:
The End Result
By the end of this tutorial, you will have a Suggestions Data Type, registered in the backoffice, and assigned to a Document Type. This Data Type can create and suggest values.
At the end of the final step, a dropdown displaying the entire suggestions-property-editor-ui.element.ts and umbraco-package.json files is available.
Setting up a plugin
Follow the Vite Package Setup by creating a new project folder called "
suggestions" inApp_Plugins.Create a manifest file to define and configure the property editor using either JSON or TypeScript.
Create a manifest file named umbraco-package.json at the root of the suggestions folder, and add the following code:
Extension authors define the property editor UI manifest, then register it dynamically during runtime using a Backoffice Entry Point extension.
Create a manifest file named manifests.ts and add the following code:
The umbraco-package.json files are cached by the server. When creating new umbraco-package.json files, it might take a few seconds before those are loaded into the server cache.
It is important to select the right propertyEditorSchemaAlias as it affects how the Property Editor data is made available when rendering the website.
In this example, Umbraco.Plain.String is selected because a string value is expected. For more options, see the default Property Editor Schema aliases article.
Creating a Web Component
Create the web component for the property editor.
Create a file in the
srcfolder with the namesuggestions-property-editor-ui.element.tsIn this new file, add the following code:
In the
vite.config.tsfile, replace the following:
entryto the newly created.tsfile.outDir: 'dist'so the output lands inApp_Plugins/suggestions/dist/.
The basic parts of the editor are now in place:
The package manifest, telling Umbraco what to load
The web component for the editor
Run the build. In your terminal, go to the
suggestionsfolder and run:
Reload the backoffice.
Registering the Data Type in Umbraco
Add the newly added property editor "Suggestions" in the Document Type and save it.

The property can now be edited using the new Property Editor.
Check out the content where you will see the property editor that looks like this:

Adding styling and setting up events in the Web Components
Start by creating an input field and some buttons to style and hook up to events.
Update the render method to include some input fields and buttons in the
suggestions-property-editor-ui.element.tsfile:
The Umbraco UI library is already a part of the backoffice, which means it can be used immediately.
Add some styling. Update the import from lit to include
cssandUmbTextStyles:
Add the CSS:
Run the build. In your terminal, go to the
suggestionsfolder and run:
Reload the backoffice.
It should now look something like this:

Next, set up the event logic.
Setup Event Logic
Setup Input Field
Start with the input field. When typing something in the input field, the property editor's value should change to the input field's current value.
Dispatch a change event using one of two approaches:
Using
new CustomEvent('change')orUsing
new UmbChangeEvent()which is recommended as you can leverage the core class
Add the import so the event can be used:
Add the event to the property editor:
Look at the suggestions button next.
Setup Suggestions Button
When pressing the suggestion button, the text should update to the suggestion received. Similar to how the value of the property editor changes when writing in the input field.
The value should also change when pressing the suggestion button.
Update the import for Lit:
Add suggestions to the property editor:
Update the suggestion button in the render method to call a
onSuggestionmethod when pressing the button:
Run the build. In your terminal, go to the
suggestionsfolder and run:
Clear your cache and reload the backoffice.
Click on the Give me suggestions button to see the Suggestions Data Type in action.

When saving or publishing, the value of the Data Type is automatically synced to the current content object and sent to the server.
To learn more, visit the Property Editors page.
Going further
The Suggestions Data Type is now set up and running. The next part covers adding configurations to the property editor.
Last updated
Was this helpful?