> For the complete documentation index, see [llms.txt](https://aptitude.gitbook.io/zaubercms/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aptitude.gitbook.io/zaubercms/extending-zaubercms/custom-list-data.md).

# Custom List Data

There are three List Content Properties (DropdownList, RadioButtonList & CheckboxList). These either take a manual key/value that the user can put in, or you can define your own IDataListSource which really opens up these editors.

```csharp
public interface IDataListSource
{
    /// <summary>
    /// Name of the data list source
    /// </summary>
    string Name { get; }

    /// <summary>
    /// Description of the data list source.
    /// </summary>
    string Description { get; }

    /// <summary>
    /// Represents the Icon property of a data list source.
    /// </summary>
    string Icon { get; }

    /// <summary>
    /// The full name of the implemented data source class including namespace.
    /// </summary>
    string FullName { get; }

    /// <summary>
    /// Retrieves a list of items from a data source.
    /// </summary>
    /// <param name="scope">The service scope used for dependency injection.</param>
    /// <param name="currentContent">The current content object.</param>
    /// <returns>A collection of DataListItem objects.</returns>
    IEnumerable<DataListItem> GetItems(IServiceScope scope, Models.Content? currentContent);
}
```

As you can see the GetItems returns a list of DataListItem which is a simple class which is esentially a key/value

```csharp
public class DataListItem
{
    public string Name { get; set; } = string.Empty;
    public string Value { get; set; } = string.Empty;
}
```

As long as you can convert your data source into this format, there is really no limit to the sort of things you could make a data source. The example below show how to get a list of the available content views (This is actually used within the site on the content editor).

```csharp
public class ContentViewsDataSource(ExtensionManager extensionManager) 
: IDataListSource
{
    public string Name => "Content Views";
    public string Description => "List of the available content views";
    public string Icon => "tag";
    public string FullName => GetType().FullName ?? string.Empty;

    public IEnumerable<DataListItem> GetItems(IServiceScope scope, Content? currentContent)
    {
        var allContentViews = extensionManager.GetInstances<IContentView>(true);
        return allContentViews.Values.Select(x =>
        {
            var type = x.GetType();
            return new DataListItem
            {
                // Get the name of the component
                Name = type.Name,
                // Get the full name of the component
                Value = type.FullName!
            };
        })
        .OrderBy(x => x.Name)
        .ToList();
    }
}
```


---

# 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:

```
GET https://aptitude.gitbook.io/zaubercms/extending-zaubercms/custom-list-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
