Kinds
Create reusable, standardized configurations for extensions, helping to streamline development, ensure consistency, and reduce duplication.
A Kind is a preset configuration that extensions inherit for consistency. It reduces redundancy by defining default properties. This simplifies maintenance for extensions sharing similar functionality.
Every Kind links to a specific extension type. Extensions of that type referencing a Kind automatically inherit its settings. This ensures uniformity across different extensions.
Benefits of Using a Kind
Reduces redundancy – Defines common settings once for reuse across extensions.
Ensures consistency – Extensions using the same Kind follow a standardized structure.
Simplifies definitions – Extensions inherit predefined properties to reduce manual configuration.
Kind Registration
Register a Kind using the standard extension method. The key properties defining a Kind registration are:
type: Always set this tokind.alias: A unique identifier for the Kind.matchType: Specifies the applicable extension type.matchKind: Defines the Kind alias referenced by extensions.manifest: Contains preset values for inheritance.
Example: Registering a Button Kind for Header Apps
This example registers a Button Kind for Header Apps. It provides a preset button configuration for other extensions to reuse.
Properties:
typeis 'kind', registering it as a Kind extension.matchTypeis 'headerApp', targeting Header App extensions.matchKindis 'button', serving as the Kind's alias.The
manifestholds default properties, likeelementName, for inheritance.
Using the Kind in Other Extensions
Use a Kind by setting the type and kind properties. The extension then automatically inherits the Kind's properties.
Example: Header App Extension Using the Button Kind
Here, the extension uses kind: 'button' to inherit elementName. It also adds custom metadata to further customize behavior or appearance.
Custom Kind Example
The code below demonstrates how to create a custom kind. This Kind extension will allow extension developers to display welcome messages in the header that will greet backoffice users.

Create the Kind Extension
Start by defining and registering a new Kind extension. Select a unique name for the matchKind and manifest.elementName properties.
Create a Custom Component for welcome-header-app-message
welcome-header-app-messageCreate a custom component to render our welcome message out to the backoffice user. The manifest.elementName property in the kind manifest should match the value of @customElement and declare global { ... declarations.
Derive Header Apps Using the Custom Kind Extension
Use the previously defined Kind extension, welcomeHeaderAppMessage to create messages to display to the user for each day of the week. Properties such as manifest.elementName that are defined in the welcomeHeaderAppMessage kind extension will fall through to derived extensions. These properties do not need to be redefined in extensions that inherit from the welcomeHeaderAppMessage kind.
For each derived extension, the
kindproperty must match thematchKindproperty onwelcomeHeaderAppMessage.The
typeproperty must also match thematchTypeproperty onwelcomeHeaderAppMessage.Use
elementto import the custom component.
Register the Derived Extension
Use any standard practice to register the derived extension, in this case thursdayWelcomeMessageHeaderAppInstance is registered dynamically in an entrypoint.
Referencing the Kind ensures consistency by inheriting shared properties. This also simplifies updating configurations across multiple extensions.
Last updated
Was this helpful?