Easily restore your project to a previous version with our new Instant One-click Backup Recovery
Hygraph
Classic Docs

Extension declaration

The Extension Declaration is an object describing the extension, its capabilities and configuration options.

When registering a new extension, Hygraph will load and validate this declaration and use it to build the configurations forms.

#General declaration properties

All extension declarations share the following properties:

KeyTypeDescription
extensionTypeEnum(field, formSidebar) (required)The type of extension. Currently only field is supported
nameString (required)Display name for the Extension.
descriptionStringOptional description.
configConfigOptionsDefinitionOptional definition of global configuration options for this extension.

In the example below, we initiate a declaration for a field extension:

const declaration = {
extensionType: 'field',
name: 'Store item ID',
description: 'Reference an item from our shop',
// Field extension specific properties
fieldType: 'STRING',
features: ['FieldRenderer'],
};

#Config properties

You can use config properties to prompt the user when installing the plugin for additional settings that are made available to your UI extension.

KeyType
typeEnum(string, number,boolean) (required)
displayNameString
descriptionString
requiredBoolean
defaultValueany

In the example below we'll declare configuration for a STORE_ID and ACCESS_TOKEN.

const declaration = {
/*
... rest of the declaration
*/
config: {
STORE_ID: {
type: 'string',
displayName: 'Store ID',
required: true,
},
ACCESS_TOKEN: {
type: 'string',
displayName: 'Store Access Token',
description: 'API access token for this UI extension',
required: true,
},
// ... rest of declaration props here
},
};

When installing the above with the configuration, it would look something like:

UI Extension ConfigurationUI Extension Configuration

#Applying declaration changes

When changing your extension declaration, you need to refresh your extension settings in Hygraph and save the changes.

Applying declaration changesApplying declaration changes