Skip to main content

Register block in dashboard

Once you have created a custom block, For merchants to use the block in Appmaker Dashboard, you need to register the block in the appmaker-custom-blocks.json file.

Create a new file in the root of the theme

Create a new file appmaker-custom-blocks.json in the root of the theme. and list all the blocks schema that you want to register in the Appmaker Dashboard.

appmaker-custom-blocks.json
[
{
"title": "My custom block name",
"name": "my-theme/my-custom-block",
"attributesSchema": {
"properties": [{
"id" : "title",
"type": "string",
"label": "title"
}]
},
"config": {
"innerBlockConfig": {
"allowedBlocks": ["my-theme/my-custom-block-item"]
}
}
}
]

Optional : Add custom inner block item in Appmaker Dashboard

appmaker-custom-blocks.json
[
{
"title": "My custom inner block name",
"name": "my-theme/my-custom-block-item",
"attributesSchema": {
"properties": [{
"id" : "title",
"type": "string",
"label": "title"
}]
},
"config": {
"parent": ["my-theme/my-custom-block"]
}
}
]

Block schema properties

PropertyTypeDescriptionExample
titlestringTitle of the blockMy custom block name
namestringName of the blockmy-theme/my-custom-block
attributesSchemaobjectSchema of the attributes of the blockAttributes Shema
configobjectConfig of the block

Config properties

PropertyTypeDescriptionExample
innerBlockConfigobjectConfig of the inner blockInner block config
parentarrayParent of the block["my-theme/my-custom-block"]

Inner block config properties

PropertyTypeDescriptionExample
allowedBlocksarrayAllowed blocks["my-theme/my-custom-block-item"]