umbraco-collection
Implement collections in Umbraco backoffice using official docs
What this skill does
# Umbraco Collection
## What is it?
A Collection displays a list of entities in the Umbraco backoffice with built-in support for multiple views (table, grid), filtering, pagination, selection, and bulk actions. Collections connect to a repository for data and provide a standardized way to browse and interact with lists of items.
## Documentation
Always fetch the latest docs before implementing:
- **Main docs**: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/collections
- **Collection View**: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-types/collections/collection-view
- **Foundation**: https://docs.umbraco.com/umbraco-cms/customizing/foundation
- **Extension Registry**: https://docs.umbraco.com/umbraco-cms/customizing/extending-overview/extension-registry
## Collection Architecture
A complete collection consists of these components:
```
collection/
├── manifests.ts # Main collection manifest
├── constants.ts # Alias constants
├── types.ts # Item and filter types
├── my-collection.context.ts # Collection context (extends UmbDefaultCollectionContext)
├── my-collection.element.ts # Collection element (extends UmbCollectionDefaultElement)
├── repository/
│ ├── manifests.ts
│ ├── my-collection.repository.ts # Implements UmbCollectionRepository
│ └── my-collection.data-source.ts # API calls
├── views/
│ ├── manifests.ts
│ └── table/
│ └── my-table-view.element.ts # Table view
└── action/
├── manifests.ts
└── my-action.element.ts # Collection action
```
## Reference Example
The Umbraco source includes a working example:
**Location**: `/Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/collection/`
This example demonstrates a complete custom collection with repository, views, and context. Study this for production patterns.
## Related Foundation Skills
- **Repository Pattern**: Collections require a repository for data access
- Reference skill: `umbraco-repository-pattern`
- **Context API**: For accessing collection context in views
- Reference skill: `umbraco-context-api`
- **State Management**: For understanding observables and reactive data
- Reference skill: `umbraco-state-management`
## Workflow
1. **Fetch docs** - Use WebFetch on the URLs above
2. **Ask questions** - What entities? What repository? What views needed? What actions?
3. **Define types** - Create item model and filter model interfaces
4. **Create repository** - Implement data source and repository
5. **Create context** - Extend `UmbDefaultCollectionContext` if custom behavior needed
6. **Create views** - Implement table/grid views
7. **Create actions** - Add collection actions (create, refresh, etc.)
8. **Explain** - Show what was created and how to test
## Complete Example
### 1. Constants (constants.ts)
```typescript
export const MY_COLLECTION_ALIAS = 'My.Collection';
export const MY_COLLECTION_REPOSITORY_ALIAS = 'My.Collection.Repository';
```
### 2. Types (types.ts)
```typescript
export interface MyCollectionItemModel {
unique: string;
entityType: string;
name: string;
// Add other fields
}
export interface MyCollectionFilterModel {
skip?: number;
take?: number;
filter?: string;
orderBy?: string;
orderDirection?: 'asc' | 'desc';
// Add custom filters
}
```
### 3. Data Source (repository/my-collection.data-source.ts)
```typescript
import type { MyCollectionItemModel, MyCollectionFilterModel } from '../types.js';
import type { UmbCollectionDataSource } from '@umbraco-cms/backoffice/collection';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class MyCollectionDataSource implements UmbCollectionDataSource<MyCollectionItemModel> {
#host: UmbControllerHost;
constructor(host: UmbControllerHost) {
this.#host = host;
}
async getCollection(filter: MyCollectionFilterModel) {
// Call your API here
const response = await fetch(`/api/my-items?skip=${filter.skip}&take=${filter.take}`);
const data = await response.json();
const items: MyCollectionItemModel[] = data.items.map((item: any) => ({
unique: item.id,
entityType: 'my-entity',
name: item.name,
}));
return { data: { items, total: data.total } };
}
}
```
### 4. Repository (repository/my-collection.repository.ts)
```typescript
import type { MyCollectionFilterModel } from '../types.js';
import { MyCollectionDataSource } from './my-collection.data-source.js';
import { UmbRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbCollectionRepository } from '@umbraco-cms/backoffice/collection';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class MyCollectionRepository extends UmbRepositoryBase implements UmbCollectionRepository {
#dataSource: MyCollectionDataSource;
constructor(host: UmbControllerHost) {
super(host);
this.#dataSource = new MyCollectionDataSource(host);
}
async requestCollection(filter: MyCollectionFilterModel) {
return this.#dataSource.getCollection(filter);
}
}
export default MyCollectionRepository;
```
### 5. Repository Manifest (repository/manifests.ts)
```typescript
import { MY_COLLECTION_REPOSITORY_ALIAS } from '../constants.js';
export const manifests: Array<UmbExtensionManifest> = [
{
type: 'repository',
alias: MY_COLLECTION_REPOSITORY_ALIAS,
name: 'My Collection Repository',
api: () => import('./my-collection.repository.js'),
},
];
```
### 6. Collection Context (my-collection.context.ts)
```typescript
import type { MyCollectionItemModel, MyCollectionFilterModel } from './types.js';
import { UmbDefaultCollectionContext } from '@umbraco-cms/backoffice/collection';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
// Default view alias - must match one of your collectionView aliases
const MY_TABLE_VIEW_ALIAS = 'My.CollectionView.Table';
export class MyCollectionContext extends UmbDefaultCollectionContext<
MyCollectionItemModel,
MyCollectionFilterModel
> {
constructor(host: UmbControllerHost) {
super(host, MY_TABLE_VIEW_ALIAS);
}
// Override or add custom methods if needed
}
export { MyCollectionContext as api };
```
### 7. Collection Element (my-collection.element.ts)
```typescript
import { customElement } from '@umbraco-cms/backoffice/external/lit';
import { UmbCollectionDefaultElement } from '@umbraco-cms/backoffice/collection';
@customElement('my-collection')
export class MyCollectionElement extends UmbCollectionDefaultElement {
// Override renderToolbar() to customize header
// protected override renderToolbar() {
// return html`<umb-collection-toolbar slot="header"></umb-collection-toolbar>`;
// }
}
export default MyCollectionElement;
export { MyCollectionElement as element };
declare global {
interface HTMLElementTagNameMap {
'my-collection': MyCollectionElement;
}
}
```
### 8. Table View (views/table/my-table-view.element.ts)
```typescript
import type { MyCollectionItemModel } from '../../types.js';
import { UMB_COLLECTION_CONTEXT } from '@umbraco-cms/backoffice/collection';
import { css, customElement, html, state } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbTableColumn, UmbTableConfig, UmbTableItem } from '@umbraco-cms/backoffice/components';
@customElement('my-table-collection-view')
export class MyTableCollectionViewElement extends UmbLitElement {
@state()
private _tableItems: Array<UmbTableItem> = [];
@state()
private _selection: Array<string> = [];
#collectionContext?: typeof UMB_COLLECTION_CONTEXT.TYPE;
private _Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.