In this tutorial, you will learn how to improve your content modelling skills within Umbraco V8. This will be possible through the use of property editors and data types. Like most CMS systems, Umbraco comes with a bunch of properties you can associate with your document-types. These properties will allow content-editors to add data onto pages. These pages will eventually get published on the frontend website for customer and visitor to read.

Picking the correct properties to use on a document-type is key in creating a good experience for the content editors and your site visitors. Umbraco ships with more properties than any other CMS that I know of. This includes staples like a rich-text editor, a date-picker, and a media picker. Understanding the theory behind properties is however not straightforward. In Umbraco, we have property-list-editors and data-types. In this article you will learn the difference between these two things, as well as learning about the different type of properties that are available out-of-the-box with Umbraco, sounds good? Let's go!

Property Editors Explained

Property editors and data types combined, define the mechanism of how properties are created and applied to document-types within the CMS. A property editor is defined using a manifest file. The manifest will define the meta-data about the property and its associated files. The editor manifest will contain references to all the C#, HTML, CSS and JS that is required to render that property within the CMS. A data-type on the other hand is a purely conceptual feature. A data-type provides an abstraction layer between a property-editor and a property being applied to a document-type. Data types promote better re-use. For example, let us say that you wanted to create a property that only allowed email addresses to be entered into it. The core CMS ships with a text property editor, without a data type there would be no way to customise this existing property. By adding a field into the text property editor that allowed a regex to be added as well, you would create reduce duplication.

How would you build this into the CMS? This is where a data-type comes into play. Data types prevent the need for this type of duplication. Instead of creating a new property editor for this slightly nuanced variation, you would create a data-type. The data-type could use the property-list-editor as the template for the fields. The email regex would be added to the data-type and saved. The email data-type can then be used in the CMS in multiple places. If you wanted to create a data-type that only allowed email addresses with a 'co.uk' format. You could simply create a new data-type, rather than having to copy all the code and create a branch new property list editor. Make sense?

This decoupling of the thing that is added onto document-types (data-type) and implementation code that defines the fields for the type (property-list-editor) can be handy. In most cases, this abstraction is not really needed. In fact, I tend to find data-type seem to cause more problems than they solve frequently. If you are in a rush, it is very easy to forget to use an existing data type. This can result in multiple data types being created within the CMS that all do the same thing. If you do this then copying all the code to make different properties actually make the backend easier to use!!! So data-types are handy as long as the editors use them correctly.

The Properties List Editors List

Out-of-the-box, Umbraco comes with a number of pre-installed property list editors. In this section, I will cover all the simple ones and provide a brief code snippet to help clarify how you can use each one:

Checkbox

A boolean property picker:

Checkbox Getting Started Guide

Checkbox List

A property that allows a content editor to create a list based on string values:

Checkbox List Getting Started Guide

Color Picker

A hex-colour code picker property that a content editor can choose from:

Color Picker Getting Started Guide

Content Picker

A property to allow a content editor to pick a specific page from the content tree:

Content Picker Getting Started Guide

DateTime

A date picker:

Date Picker Getting Started Guide

Decimal

A decimal number picker. The property can be additionally configured to limit numbers to within a range using a min and max value.

Decimal Getting Started Guide

Dropdown

A dropdown list picker. This property can be configured to return a list or a single value.

Dropdown Getting Started Guide

Email Address

A textbox with email validation property:

File Upload

A documents, images, or media uploader property. Items added through this property will be added into the media library.

File Upload Getting Started Guide

Grid Layout

Allows a content editor to build dynamic pages:

Grid Layout Getting Started Guide

Image Cropper

An image picker property. The property will return the path to an image. It will allow a focal point to be selected. It will also allow for any associated crop variations to be returned as well:

Image Cropper Getting Started Guide

Label

Renders a pre-set value. The type of data is configurable, so you can set the label to store a string, int, decimal, date, etc..

Label Getting Started Guide

Markdown editor

A property to allow content to be added in Markdown:

Markdown Getting Started Guide

Media Picker

A property used to render an asset from the media library:

Media Picker Getting Started Guide

Member Picker

This property will allow a content editor to pick a member stored within the Umbraco members table:

Member Group Picker Getting Started Guide

Multi-Url Picker

A property that allows for multiple URLs to be selected. The URLs can be either internal, external, or even media library URLs:

Multi-Url Picker Getting Started Guide

Multi-node Tree Picker

A property that allows content editors to pick one or more nodes from the CMS:

Multi-node Tree Picker Getting Started Guide

Nested Content

A property that allows content editors to build pages.

Nested Content Getting Started Guide

Numeric

A whole-number picker property:

Numeric Getting Started Guide

Radio-button list

A radio-list property that allows a content editor to pick a single value from a list:

Radio Button List Getting Started Guide

Repeatable Text Strings

A property that allows for a list of strings to be created, e.g. data for an ordered/unordered HTML list:

Multiple Textbox Getting Started Guide

Rich Text Editor

A property that allows content editors to add content using a text-editor:

Rich-text Editor Getting Started Guide

Slider

The name of this property is probably slightly confusing. This property will allow a content editor to pick a property within a range of two numbers using a slider. The property should not be confused as a tool for building a carousel! The property has two modes, one that allows a content editor to pick one value and returns a decimal, like this:

The other mode is the multi-mode. This mode will allow a content editor to pick a min and a max value and return a range, like so:

Tags

A property that allows a content editor to apply a taxonomy to a document-type:

Tags Getting Started Guide

Textarea

Bog standard text area property, e.g. text on many lines:

Textarea Getting Started Guide

Textbox

Bog standard text property:

Textbox Getting Started Guide

User picker

A property that allows a content editor to select CMS users. This property queries the user table, rather than the member table:

User Picker Getting Started Guide