> 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/17.latest/collections/list-views.md).

# List Views

Configuring the list view of a collection in Umbraco UI Builder.

A list view displays a collection entity in a list format and includes features like pagination, custom data views, searching, and bulk actions.

![A collection list view](https://2099605805-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXdAOUcqxoBqXe5oCQF8z%2Fuploads%2Fgit-blob-b9a90f0f82e12e729673344bad48cd5dbe7783dd%2Flistview.png?alt=media)

## Configuring a List View

The list view configuration is a sub-configuration of a [`Collection`](/umbraco-ui-builder/17.latest/collections/the-basics.md) config builder instance and can be accessed via the `ListView` method.

### Using the `ListView()` Method

Accesses the list view configuration for the specified collection.

#### Method Syntax

```cs
ListView(Lambda listViewConfig = null) : ListViewConfigBuilder<TEntityType>
```

#### Example

```csharp
collectionConfig.ListView(listViewConfig => {
    ...
});
```

## Adding a Field to the List View

### Using the `AddField()` Method

Adds a specified property to the list view.

#### Method Syntax

```cs
AddField(Lambda propertyExpression, Lambda fieldConfig = null) : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
listViewConfig.AddField(p => p.FirstName, fieldConfig => {
    ...
});
```

## Changing the Heading of a Field

### Using the `SetHeading()` Method

Sets the heading for a field in the list view.

#### Method Syntax

```cs
SetHeading(string heading) : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
fieldConfig.SetHeading("First Name");
```

## Formatting the Value of a Field

### Using the `SetFormat()` Method

Sets the format expression to the field in the list view.

#### Method Syntax

```cs
SetFormat(Lambda formatExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
fieldConfig.SetFormat((v, p) => $"{v} years old");
```

## Setting the View of a Field

You can customize the field's markup with field views, allowing richer visualizations of the content. For more details, see the [Field Views](/umbraco-ui-builder/17.latest/collections/list-views/field-views.md) article.

### Using the `SetView()` Method

Sets the view component for the list view field.

#### Method Syntax

```cs
SetView(string viewComponentName) : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
fieldConfig.SetView("ImageFieldView");
```

### Using the `SetView<TView>()` Method

Sets the view component for the list view field.

#### Method Syntax

```cs
SetView<TView>() : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
fieldConfig.SetView<ImageFieldView>();
```

## Setting the Visibility of a Field

### Using the `SetVisibility()` Method

Controls the runtime visibility of a field in the list view.

#### Method Syntax

```cs
SetVisibility(Predicate<ListViewFieldVisibilityContext> visibilityExpression) : ListViewFieldConfigBuilder<TEntityType, TValueType>
```

#### Example

```csharp
fieldConfig.SetVisibility(ctx => ctx.UserGroups.Any(x => x.Alias == "editor"));
```

## Changing the Page Size

### Using the `SetPageSize` Method

Sets the number of items per page for the list view.

#### Method Syntax

```cs
SetPageSize(int pageSize) : ListViewConfigBuilder<TEntityType>
```

#### Example

```csharp
listViewConfig.SetPageSize(20);
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
