Configuring field views in Umbraco UI Builder, the backoffice UI builder for Umbraco.
Field Views allow you to customize the markup used by a field when displayed in a list view. Field Views are implemented as .NET Core View Components that are passed a single FieldViewsContext
argument with information about the entity/field being rendered.
You can define a field view in one of two ways.
FieldView
view componentThe simplest way to define a field view for non-complex fields is to place a view file in the /Views/Shared/Components/FieldView
folder with the following markup.
When registering a basic file view you can pass the name of the view file (excluding the .cshtml
file extension) to the relevant API method.
To define a more complex field view you can create your own view component class (which can use dependency injection for any required dependencies). This can be done by using the following signature:
It's important to know that the FieldViewContext
parameter to the InvokeAsync
method MUST be named context
.
For the view element of your component, based on the example above, you would place a file Default.cshtml
into the /Views/Shared/Components/MyComplexFieldView
folder with the following markup:
Field view components are passed a FieldViewContext
object with the following information:
A field view is assigned to a list view field as part of the list view configuration. For more information you can check the List View Documentation.
Configuring the list view of a collection in Umbraco UI Builder, the backoffice UI builder for Umbraco.
A list view is a list-based view of a collection entity providing features: pagination for large collections, custom data views, searching, and bulk actions.
The list view configuration is a sub-configuration of a Collection
config builder instance and is accessed via its ListView
method.
Accesses the list view config of the given collection.
Adds the given property to the list view.
Sets the heading for the list view field.
Sets the format expression for the list view field.
With field views, you can customize the markup the list view's field so you can show richer visualizations of the field's content. For more information you can check the Field Views Documentation.
Sets the view component for the list view field.
Sets the view component for the list view field.
Sets the runtime visibility of the list view field.
Sets the number of items to display per page for the given list view.