> For the complete documentation index, see [llms.txt](https://docs.umbraco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbraco.com/umbraco-ui-builder/13.latest/collections/list-views/field-views.md).

# Field Views

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.

## Defining a field view

You can define a field view in one of two ways.

### **1. A basic view file for the built in `FieldView` view component**

The 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.

```csharp
@model Umbraco.UIBuilder.Web.Models.FieldViewContext
<!-- Insert your markup here -->
```

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.

### **2. A complete custom view component**

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:

```csharp
// Example
public class MyComplexFieldViewViewComponent : ViewComponent
{
    public async Task<IViewComponentResult> InvokeAsync(FieldViewContext context)
    {
        // Do your custom logic here

        return View("Default", model);
    }
}
```

{% hint style="info" %}
It's important to know that the `FieldViewContext` parameter to the `InvokeAsync` method **MUST** be named `context`.
{% endhint %}

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:

```csharp
@model Namespace.Of.Model.Returned.By.Custom.ViewComponent
<!-- Insert your markup here -->
```

## The field view context

Field view components are passed a `FieldViewContext` object with the following information:

```csharp
public class FieldViewContext
{
    public string ViewName { get; set; }
    public object Entity { get; set; }
    public string PropertyName { get; set; }
    public object PropertyValue { get; set; }
}
```

## Setting the field view of a list view field

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](/umbraco-ui-builder/13.latest/collections/list-views.md#setting-the-view-of-a-field).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.umbraco.com/umbraco-ui-builder/13.latest/collections/list-views/field-views.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
