umbraco-context-api

Share services and state across Umbraco backoffice component hierarchies via provider-consumer context tokens.

4|Updated Mar 6, 2026
One-click install
npx skills add https://github.com/albanistrefi/umbraco_CLI --skill umbraco-context-api-albanistrefi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: umbraco-context-api
Source: https://github.com/albanistrefi/umbraco_CLI/tree/main/skills/foundation/umbraco-context-api
Command: npx skills add https://github.com/albanistrefi/umbraco_CLI --skill umbraco-context-api-albanistrefi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of sharing reusable backoffice state and functionality across component hierarchies in Umbraco without creating tight coupling between extensions.

Core Features & Use Cases

  • Context provision and consumption: Provide data/services at a higher level and let descendant components access them safely through tokens.
  • Subscription and one-time access patterns: Use subscriptions for initialization-time availability and one-time retrieval for user-triggered actions.
  • Works with Umbraco built-in contexts: Integrates with common contexts like notifications, current user, modal manager, document workspace, block entry, and property dataset.

Quick Start

Fetch the latest Context API docs, decide whether you need a subscription or a one-time context lookup, and then implement consumption or provision using the official context tokens so your extension can exchange data through the DOM hierarchy.

Frequently Asked Questions about umbraco-context-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share state across Umbraco backoffice components without tight coupling?

The Umbraco Context API enables type-safe sharing of services and state across backoffice component hierarchies via a provider-consumer model using custom tokens. You provide data at a higher level so descendant extensions can consume it without tight coupling.

What is the difference between subscription and one-time context retrieval in Umbraco extensions?

Use subscriptions for initialization-time context availability and one-time retrieval for user-triggered actions. Subscriptions ensure descendant components access built-in contexts like notifications during setup, while one-time lookups fetch data on demand.

Can I access built-in Umbraco contexts like notifications and current user in custom extensions?

Yes, the Context API integrates with built-in Umbraco contexts like notifications, current user, modal manager, document workspace, block entry, and property dataset. You consume these official contexts using standard context tokens within your extension hierarchy.

How do I provide custom context tokens for downstream consumers in Umbraco backoffice?

Use provideContext to cascade custom context tokens down the DOM hierarchy for downstream consumers. Define your custom token, provide it at a higher component level, and let descendant extensions retrieve it safely using consumeContext or getContext patterns.

Does the Umbraco Context API require TypeScript for extension development?

TypeScript ensures type-safe sharing of services and state across Umbraco backoffice component hierarchies via the Context API. Following official documentation patterns for consumeContext, getContext, and provideContext requires TypeScript to maintain type safety with custom tokens.

When should I not use the Context API for sharing data in Umbraco backoffice extensions?

Avoid the Context API when components need direct, immediate data exchange without hierarchical cascading, since the provider-consumer model relies on DOM hierarchy availability. For non-cascading data sharing or tightly coupled components, alternative dependency injection patterns may be more appropriate.