Skip to content

Commit de16d9b

Browse files
committed
Revamp "Kind" documentation: clarified descriptions, updated examples for consistency, removed outdated warnings, and refined TypeScript integration details.
1 parent 155cc38 commit de16d9b

File tree

1 file changed

+26
-17
lines changed
  • 16/umbraco-cms/customizing/extending-overview/extension-types

1 file changed

+26
-17
lines changed

16/umbraco-cms/customizing/extending-overview/extension-types/kind.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
---
2-
description: A kind extension provides the preset for other extensions to use.
2+
description: Create reusable, standardized configurations for extensions, helping to streamline development, ensure consistency, and reduce duplication.
33
---
44

55
# Kind
66

7-
{% hint style="warning" %}
8-
This page is a work in progress and may undergo further revisions, updates, or amendments. The information contained herein is subject to change without notice.
9-
{% endhint %}
10-
11-
A Kind is a preset configuration that can be inherited by extensions to ensure consistency and reduce redundancy. It defines a set of default properties or behaviors that extensions can adopt, making it easier to maintain and configure extensions that share similar functionality.
7+
A Kind is a preset configuration that extensions can inherit to ensure consistency and reduce redundancy. It defines a set of default properties or behaviors that extensions can adopt, making it easier to maintain and configure extensions that share similar functionality.
128

139
A Kind is always linked to a specific extension type. Extensions using the same type and referencing a Kind automatically inherit its settings, ensuring uniformity across different extensions.
1410

@@ -33,7 +29,7 @@ To register a Kind, use the same method as other extensions. The key properties
3329
The following example shows how to register a Button Kind for [**Header Apps**](../extension-types/header-apps.md). This kind provides a preset configuration for a button element that can be reused by other Header App extensions.
3430

3531
```typescript
36-
const manifest: ManifestKind = {
32+
const manifest: ManifestKind<UmbExtensionManifest> = {
3733
type: 'kind',
3834
alias: 'Umb.Kind.MyButtonKind', // Unique alias for the Kind
3935
matchType: 'headerApp', // Applies to Header App extensions
@@ -49,7 +45,7 @@ In this example:
4945

5046
- `type` is set to 'kind' to register it as a Kind extension.
5147
- `matchType` is 'headerApp', specifying that this Kind is for Header App extensions.
52-
- `matchKind` is 'button', which is the alias of the Kind.
48+
- `matchKind` is 'button,' which is the alias of the Kind.
5349
- The `manifest` contains default properties like elementName that extensions using this Kind will inherit.
5450

5551
## Using the Kind in Other Extensions
@@ -80,32 +76,46 @@ In this example, the Header App extension uses the `kind: 'button'`, meaning it
8076

8177
Here’s an example of how to register and use the Button Kind in a Header App extension:
8278

79+
{% code title="kinds/manifests.ts" %}
80+
81+
{% hint style="warning" %}
82+
This example uses the dynamic extension registration approach. `umbExtensionsRegistry.register()` might be called from within an entrypoint lifecycle method like `onInit()`. For more information, see the [Backoffice Entry Point](./backoffice-entry-point.md) article.
83+
{% endhint %}
84+
8385
```typescript
8486
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
87+
import type { ManifestKind } from "@umbraco-cms/backoffice/extension-api";
8588

86-
const manifest: UmbExtensionManifest = {
89+
const manifest: ManifestKind<UmbExtensionManifest> = {
8790
type: 'kind',
8891
alias: 'Umb.Kind.MyButtonKind', // Alias for the Kind
8992
matchType: 'headerApp', // Extension type the Kind applies to
90-
matchKind: 'button', // Defines the Kind alias
93+
matchKind: 'customHeaderAppButton', // Defines the Kind alias
9194
manifest: {
9295
elementName: 'umb-header-app-button',
9396
},
9497
};
9598

9699
umbExtensionsRegistry.register(manifest);
97100
```
101+
{% endcode %}
98102

99-
This code registers the Button Kind, so other Header App extensions using `type: 'headerApp'` and `kind: 'button'` will inherit the preset `elementName: 'umb-header-app-button'`.
103+
This code registers the Button Kind, so other Header App extensions using `type: 'headerApp'` and `kind: 'customHeaderAppButton'` will inherit the preset `elementName: 'umb-header-app-button'`.
100104

101-
Now, another Header App extension can be created without defining `elementName`, as it will automatically inherit it from the Kind:
105+
Now another Header App extension can be created without defining `elementName`, as it will automatically inherit it from the Kind:
106+
107+
{% code title="kinds/manifests.ts" %}
108+
109+
{% hint style="warning" %}
110+
This example uses the dynamic extension registration approach. `umbExtensionsRegistry.register()` might be called from within an entrypoint lifecycle method like `onInit()`. For more information, see the [Backoffice Entry Point](./backoffice-entry-point.md) article.
111+
{% endhint %}
102112

103113
```typescript
104-
import { extensionRegistry } from '@umbraco-cms/extension-registry';
114+
import { umbExtensionsRegistry } from "@umbraco-cms/backoffice/extension-registry";
105115

106116
const manifest = {
107117
type: 'headerApp', // Extension type
108-
kind: 'button', // References the 'button' Kind
118+
kind: 'customHeaderAppButton', // References the matchKind property ('customHeaderAppButton')
109119
name: 'My Header App Example',
110120
alias: 'My.HeaderApp.Example',
111121
meta: {
@@ -115,9 +125,8 @@ const manifest = {
115125
},
116126
};
117127

118-
extensionRegistry.register(manifest);
128+
umbExtensionsRegistry.register(manifest);
119129
```
130+
{% endcode %}
120131

121132
By referencing the Kind, the extension inherits shared properties like `elementName`, ensuring consistency and reducing redundancy across extensions. This method also makes it easier to update configurations across multiple extensions.
122-
123-
By using Kinds, you can create reusable, standardized configurations for extensions, helping to streamline development, ensure consistency, and reduce duplication. Understanding how to register and reference Kinds effectively will enhance the maintainability of your Umbraco extensions.

0 commit comments

Comments
 (0)