Skip to main content

@conditions

The @conditions decorator is used to mark a method of a NodeBlock that defines the possible conditions (also called condition templates) for the block. The builder uses this method to populate a list with possible conditions, so the user can easily add new conditions to the form.

Decorator type

Method ℹ️

Applies to

Decorator signature

@conditions

Decorated method signature

(conditions: ConditionsOrchestrator): void

Decorated method parameters

NameTypeOptionalDescription
conditionsConditionsOrchestratorNoReference to the ConditionsOrchestrator instance that is used to define possible conditions for a NodeBlock.
tip

The ConditionsOrchestrator instance is also available using the conditions property of a NodeBlock.

Example

import { tripetto, conditions, NodeBlock } from "@tripetto/builder";

@tripetto({
type: "node",
identifier: "example-block",
label: "Example",
icon: "data:image/svg+xml;base64,PHN2ZyAvPg=="
})
class ExampleBlock extends NodeBlock {
@conditions
onConditions(): void {
// Define conditions here...

this.conditions.template({
condition: ExampleCondition
});
}
}