Skip to main content

@slots

The @slots decorator is used to mark a method of a NodeBlock that defines the slots for the block. Slots are used by the forms to store the collected data.

Decorator type

Method ℹ️

Applies to

Decorator signature

@slots

Decorated method signature

(slots: Slots): void

Decorated method parameters

NameTypeOptionalDescription
slotsSlotsNoReference to the Slots instance that is used to define the slots for the block.
tip

The Slots instance is also available using the slots property of a NodeBlock.

Example

import { _, tripetto, slots, NodeBlock, Slots } from "@tripetto/builder";

@tripetto({
type: "node",
identifier: "example-block",
label: "Example",
icon: "data:image/svg+xml;base64,PHN2ZyAvPg=="
})
class ExampleBlock extends NodeBlock {
@slots
onSlots(): void {
// Let's define a slot that holds a text value
this.slots.static({
type: Slots.Text,
reference: "value",
label: _("Example value")
});
}
}