Skip to main content

NodeBlock class

📖 Description​

The NodeBlock class is an abstract class for creating node blocks for the builder. A node block defines a behavior for a Node. An instance of a derived NodeBlock class is created using the assignBlock method of a Node.

tip

Follow this tutorial to learn how to build a custom block.

🎀 Applicable decorators​

The following decorators can be applied in this class:

Class decorators ℹī¸â€‹

Property decorators ℹī¸â€‹

Method decorators ℹī¸â€‹

📌 Statics​


🏷ī¸ icon​

Contains the icon of the block.

Type​

SVGImage | string


🏷ī¸ identifier​

Contains the type identifier of the block.

Type​

string


🏷ī¸ kind​

Contains the kind of block. It can be one of the following values:

  • ui: Visual block that the user can see and interact with (for example, a text input field);
  • headless: Invisible block that can perform a certain action.

Type​

"ui" | "headless"


🏷ī¸ label​

Retrieves the localized label (name) of the block.

Type​

string


🏷ī¸ version​

Contains the version of the block.

Type​

string


🔧 flag​

Verifies if the block has the specified flag enabled.

tip

Flags can be set using the flag function.

Signature​

flag(id: string): boolean

Parameters​

NameTypeOptionalDescription
idstringNoSpecifies the flag identifier to verify.

Return value​

Returns true if the specified flag was enabled.

🗃ī¸ Fields​


🏷ī¸ allowMarkdown​

Specifies if markdown is supported in the label of the block.

info

When omitted, basic markdown formatting (bold, italic, underline, strikethrough and hyperlinks) is supported.

Type​

boolean


🏷ī¸ conditions​

Retrieves the ConditionsOrchestrator instance used to define conditions for the block.

info

You should use the @conditions decorator to mark the method that defines the conditions.

Type​

ConditionsOrchestrator


🏷ī¸ editor​

Retrieves the EditorOrchestrator instance used to define the controls to manage the block.

info

You should use the @editor decorator to mark the method that implements the controls.

Type​

EditorOrchestrator


🏷ī¸ icon​

Retrieves the icon of the node block.

Type​

SVGImage | string


🏷ī¸ id​

Retrieves the identifier of the node.

Type​

string


🏷ī¸ isInitialized​

Retrieves if the block is initialized.

Type​

boolean


🏷ī¸ isRequired​

Retrieves if the block is required or can be skipped.

tip

This property is used by the builder to visually indicate if a node is required.

Type​

boolean


🏷ī¸ label​

Retrieves the label of the node block. This label is shown in the builder.

Type​

string


🏷ī¸ node​

Retrieves a reference to the Node instance that holds the block.

Type​

Node


🏷ī¸ slots​

Retrieves a reference to the Slots collection instance.

Type​

Slots

â–ļī¸ Methods​


🔧 detectChange​

Notifies the builder that a change has occurred and the definition has changed.

info

Change detection is normally handled automatically. The builder monitors all block properties that are decorated with the @definition decorator.

Signature​

detectChange(): void

🔧 rerender​

Rerenders the block.

Signature​

rerender(force?: boolean): void

Parameters​

NameTypeOptionalDescription
forcebooleanYesSpecifies to force the rerendering (default is false).