Skip to content

Commit 8719bc1

Browse files
authored
Merge pull request #7565 from Luuk1983/feature/7490_context_api
Update to the Context API documentation
2 parents b0470ee + ef5617d commit 8719bc1

File tree

6 files changed

+458
-152
lines changed

6 files changed

+458
-152
lines changed

16/umbraco-cms/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
* [Umbraco Element](customizing/foundation/umbraco-element/README.md)
205205
* [Lit Element](customizing/foundation/lit-element.md)
206206
* [Context API](customizing/foundation/context-api/README.md)
207+
* [Context API Fundamentals](customizing/foundation/context-api/context-api-fundamentals.md)
207208
* [Consume a Context](customizing/foundation/context-api/consume-a-context.md)
208209
* [Provide a Context](customizing/foundation/context-api/provide-a-context.md)
209210
* [Repositories](customizing/foundation/repositories.md)

16/umbraco-cms/customizing/foundation/context-api/README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,35 @@
11
---
2-
description: The Context API is your tool to integrate with the application
2+
description: >-
3+
Learn about using the Context API for sharing data and functionality between
4+
backoffice extensions through the component hierarchy.
35
---
46

57
# Context API
68

7-
The Context API enables receiving APIs. Depending on where your code is executed from, it affects which and what instances of APIs can be received. The DOM structure defines the scope of who can gain access to what APIs. This is because the APIs are provided via an element and can then only be consumed by code running on itself or descendant elements.
9+
The Context API is a powerful communication system in Umbraco's backoffice. It enables extensions to share data and functionality through the component hierarchy without tight coupling. Think of it as a way for different parts of your UI to talk to each other and access shared services.
10+
11+
Contexts are used throughout the Umbraco backoffice to provide access to workspace data, notifications, user information, and many other services. When building custom extensions, you will often need to consume existing contexts or create your own to share functionality between your components.
12+
13+
## Key Concepts
14+
15+
The Context API is built on a few core principles:
16+
17+
* **Provider-Consumer Pattern**: Parent elements provide contexts that descendant elements can consume
18+
* **Loose Coupling**: Components don't need direct references to each other
19+
* **Hierarchical**: Contexts flow down through the DOM tree
20+
* **Type-Safe**: Context Tokens ensure you get the right context
21+
22+
The Context API provides a structured way to access and share functionality when building property editors, workspace extensions, dashboards, or any other backoffice UI.
23+
24+
## [Context API Fundamentals](context-api-fundamentals.md)
25+
26+
Learn the core concepts, terminology, and flow mechanisms of the Context API. Understand how contexts are provided and consumed through the element hierarchy, and explore common context types used throughout Umbraco.
27+
28+
## [Consume a Context](consume-a-context.md)
29+
30+
Learn how to consume contexts in your extensions using one-time references or subscriptions. This guide covers consuming contexts in UI elements, services, and non-UI classes, with practical code examples for each scenario.
31+
32+
## [Provide a Context](provide-a-context.md)
33+
34+
Learn how to create and provide your own custom contexts. Make your data and functionality available to descendant elements in the component hierarchy.
835

9-
##

0 commit comments

Comments
 (0)