Editors
Configuring the editor of a collection in Umbraco UI Builder.
An editor is the user interface used to edit an entity. It consists of tabs and property editors.
Configuring an Editor
The editor configuration is a sub-configuration of a Collection config builder instance and is accessed via the Editor method.
Using the Editor() Method
Editor() MethodAccesses the editor configuration for the specified collection.
Method Syntax
Example
Adding a Tab to an Editor
Using the AddTab() Method
AddTab() MethodAdds a tab to the editor.
Method Syntax
Example
Configuring a Sidebar to a Tab
A sidebar is a smaller section displayed on the right side of the main editor. It can contain fieldsets and fields, similar to tabs, but with limited space. The sidebar is ideal for displaying entity metadata.
Using the Sidebar() Method
Sidebar() MethodConfigures the sidebar for the tab.
Method Syntax
Example
Setting the Visibility of a Tab
Using the SetVisibility() Method for Tabs
SetVisibility() Method for TabsDetermines the visibility of the tab at runtime.
Method Syntax
Example
Adding a Fieldset to a Tab
Using the AddFieldset() Method
AddFieldset() MethodAdds a fieldset to a tab.
Method Syntax
Example
Setting the Visibility of a Fieldset
Using the SetVisibility() Method for Fieldsets
SetVisibility() Method for FieldsetsDetermines the visibility of a fieldset at runtime.
Method Syntax
Example
Adding a Field to a Fieldset
Using the AddField() Method
AddField() MethodAdds a property field to the editor.
Method Syntax
Example
Changing the Label of a Field
By default, Umbraco UI Builder converts property names into readable labels by splitting camel case names. You can override this behavior by setting an explicit label.
Using the SetLabel() Method
SetLabel() MethodSets a custom label for a field.
Method Syntax
Example
Hiding the Label of a Field
Sometimes, a field works better without a label, especially in full-width layouts.
Using the HideLabel() Method
HideLabel() MethodHides the field label.
Method Syntax
Example
Adding a Description to a Field
Using the SetDescription() Method
SetDescription() MethodAdds a description to the field.
Method Syntax
Example
Changing the Data Type of a Field
By default, Umbraco UI Builder assigns a suitable Data Type for basic field types. However, you can specify a custom Data Type.
Using the SetDataType() Method
SetDataType() MethodAssigns an Umbraco Data Type by name or ID.
Method Syntax (by name)
Example
Method Syntax (by ID)
Example
Setting the Default Value of a Field
Using the SetDefaultValue() Method
SetDefaultValue() MethodSets a static default value.
Method Syntax
Example
Using the SetDefaultValue() Method (Function-Based)
SetDefaultValue() Method (Function-Based)Defines a function to compute the default value at the time of entity creation.
Method Syntax
Example
Making a Field Required
Using the MakeRequired() Method
MakeRequired() MethodMarks a field as required.
Method Syntax
Example
Validating a Field
Using the SetValidationRegex() Method
SetValidationRegex() MethodApplies a regular expression for field validation.
Method Syntax
Example
Making a Field Read-only
Using the MakeReadOnly() Method
MakeReadOnly() MethodThis method makes the current field read-only, preventing any user modifications in the UI. Once applied, the field's value remains visible but cannot be edited.
Method Syntax
Example
Using the MakeReadOnly(Func<TValueType, string>) Method
MakeReadOnly(Func<TValueType, string>) MethodThis method makes the current field read-only, preventing user edits in the UI. Additionally, it allows specifying a custom formatting expression, which determines how the field value is displayed as a string.
Method Syntax
Example
Using the MakeReadOnly(object dataTypeNameOrId) Method
MakeReadOnly(object dataTypeNameOrId) MethodThis method makes the current field read-only, preventing user edits in the UI. Additionally, it allows specifying a Data Type name or ID to determine how the field should be rendered when in read-only mode.
Method Syntax
Example
Using the MakeReadOnly(Predicate<>) Method
MakeReadOnly(Predicate<>) MethodThis method makes the current field read-only in the UI if the provided runtime predicate evaluates to true, preventing user edits.
Method Syntax
Example
Using the MakeReadOnly(Predicate<>, Func<>) Method
MakeReadOnly(Predicate<>, Func<>) MethodThis method makes the current field read-only in the UI if the provided runtime predicate evaluates to true, preventing user edits. It also allows specifying a custom formatting expression to render the field’s value as a string.
Method Syntax
Example
Using the MakeReadOnly(Predicate<>, Func<>) Method
MakeReadOnly(Predicate<>, Func<>) MethodThis method makes the current field read-only in the UI if the provided runtime predicate evaluates to true, preventing user edits. It also allows specifying a Data Type name or ID to use when the field is in read-only mode.
Method Syntax
Example
Setting the Visibility of a Field
Using the SetVisibility() Method for Fields
SetVisibility() Method for FieldsControls field visibility at runtime.
Method Syntax
Example
Last updated
Was this helpful?