Skip to content
JS Filters

lzb.constructor.wizard.templates

Filters the presets the block builder offers when creating a new block. Add your own starting point, or replace the collection entirely.

The filter runs on every render of the wizard rather than once at module load, so a script that registers its presets after the builder script still has them picked up.

Attributes

NameTypeDescription
templatesObjectpresets, keyed by preset slug

Each preset takes these keys:

NameTypeDescription
titleStringname shown in the wizard
iconJSX | nullicon shown beside the name in the wizard
blockIconStringSVG markup used as the icon of the block being created
categoryStringblock category, text by default
keywordsStringcomma-separated keywords for the created block
descriptionStringblock description
controlsArraycontrols to create, each with type, name, label, placement and any other control settings
templateStringstarting block code
styleStringstarting block styles, where __BLOCK_CLASSNAME__ stands for the generated class

Usage

JS
wp.hooks.addFilter(
  "lzb.constructor.wizard.templates",
  "my.custom.namespace",
  function (templates) {
    return {
      ...templates,
      "pricing-card": {
        title: "Pricing Card",
        icon: null,
        blockIcon: "",
        category: "design",
        keywords: "pricing,card,plan",
        description: "A single pricing plan with a title and a price.",
        controls: [
          {
            type: "text",
            name: "plan-title",
            label: "Plan Title",
            default: "Starter",
            placement: "inspector",
          },
          {
            type: "text",
            name: "plan-price",
            label: "Price",
            default: "$9",
            placement: "inspector",
          },
        ],
        template: `<div useBlockProps>
  <h3>{{plan-title}}</h3>
  <p>{{plan-price}}</p>
</div>`,
        style: `__BLOCK_CLASSNAME__ {
  padding: 20px;
  border: 1px solid #e0e0e0;
}`,
      },
    };
  }
);

The wizard preselects whichever preset comes first in the object, so nothing may assume a particular preset is present.

Was this article helpful?

Copyright © 2026 Lazy Blocks.