|
1 | 1 | --- |
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. |
3 | 5 | --- |
4 | 6 |
|
5 | 7 | # Context API |
6 | 8 |
|
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. |
8 | 35 |
|
9 | | -## |
|
0 commit comments