> 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-cms/model-your-content/property-editors/built-in-umbraco-property-editors/element-picker.md).

# Element Picker

`Schema Alias: Umbraco.ElementPicker`

`UI Alias: Umb.PropertyEditorUi.ElementPicker`

`Returns: IEnumerable<IPublishedElement>`

The Element Picker enables you to choose one or more elements to display as part of your content. Elements are based on [Element Types](/umbraco-cms/model-your-content/content-types-and-structure/data/defining-content/elements.md) defined in the Settings section. They are created and managed in the Library section.

## Data Type Definition Example

![Element Picker Data Type Settings](/files/YPqAePbprPRfiZcuSgEk)

### Amount

Define how many elements should be allowed to pick via the Element Picker.

### Start Node

Choose a start node for the Element Picker. Use this option when your Library section is organized into folders.

### Ignore User Start Nodes

Checking this field allows users to select items outside their assigned start nodes.

## MVC View Example

### Without Models Builder

```csharp
@{
    IEnumerable<IPublishedElement>? elements = Model.Value<IEnumerable<IPublishedElement>>("elementPicker");
    if (elements != null) {
        foreach (var element in elements)
        {
            <h1>@element.Name</h1>
            <p>@element.Value("featuredText")</p>
        }
    }
}
```

### With Models Builder

```csharp
@{
    IEnumerable<IPublishedElement>? elements = Model.ElementPicker;
    if (elements != null) {
        foreach (var element in elements)
        {
            <h1>@element.Name</h1>
            <p>@element.Value("featuredText")</p>
        }
    }
}
```

## Add values programmatically

The Element Picker stores an array of Element keys (`Guid[]`). The example below illustrates how an Element Picker value can be added or changed programmatically.

```csharp
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Serialization;
using Umbraco.Cms.Core.Services;
namespace Umbraco.Documentation;
public class ElementPickerExample
{
    private readonly IContentService _contentService;
    private readonly IJsonSerializer _jsonSerializer;
    public ElementPickerExample(IContentService contentService, IJsonSerializer jsonSerializer)
    {
        _contentService = contentService;
        _jsonSerializer = jsonSerializer;
    }
    public bool SaveElementPickerValue(Guid contentId, string propertyAlias, Guid[] pickedElementIds)
    {
        IContent? content = _contentService.GetById(contentId);
        if (content is null)
        {
            return false;
        }
        content.SetValue(propertyAlias, _jsonSerializer.Serialize(pickedElementIds));
        return true;
    }
}
```


---

# 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-cms/model-your-content/property-editors/built-in-umbraco-property-editors/element-picker.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.
