@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
Name | Type | Optional | Description |
---|---|---|---|
slots | Slots | No | Reference to the Slots instance that is used to define the slots for the block. |
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")
});
}
}