Overview
The WeaveStickyNoteNode class represents a sticky note primitive within the Weave.js canvas, designed for collaborative brainstorming, workshops, annotations, and visual boards.
Rendered as a Konva Group containing a faceted paper polygon, subtle top tape highlight, and bottom-right dog-ear fold flap, it supports interactive dragging, live resize without corner distortion, rotation, and inline text editing through Weave.js’s shared shape-label engine.
The class extends the WeaveNode class.
Label engine
Sticky note text is managed by the shared shape-label engine. By default the label uses Konva text and a DOM textarea overlay (legacy).
Set config.label.engine to native to render with the on-canvas text engine and edit with the native editing session instead (including rich-text formatting stored in labelBlocks):
new WeaveStickyNoteNode({ config: { label: { engine: "native" } } });
Sticky notes override the generic shape-label defaults with STICKY_NOTE_LABEL_DEFAULTS: top-left alignment (labelAlign: "left", labelVerticalAlign: "top"), Inter, system-ui, sans-serif at 16px, #1F2937 fill, 1.35 line height, and 16px padding (labelPaddingX / labelPaddingY). With top and bottom vertical alignment the text bounds exclude the padding, the dog-ear fold corner and the optional author footer margin. With middle only the padding and the author line are excluded, so the text is centered in the space above the author line (on the sheet when there is no author) and a long text may run over the fold.
Label edit events
With the native label engine the node emits onEnterShapeLabelEditMode when a label edit session starts and
onExitShapeLabelEditMode when it ends. Exit receives { node: Konva.Group }; enter also receives the live
session. While editing, onShapeLabelFormatChange receives { node, format } whenever the selection format changes.
The legacy engine does not emit them.
TypeScript types
type WeaveNodeTransformerProperties = Konva.TransformerConfig;
type WeaveShapeLabelConfig = {
engine: "legacy" | "native"; // default "legacy"
};
type WeaveStickyNoteProperties = {
transform: Partial<WeaveNodeTransformerProperties>;
label?: Partial<WeaveShapeLabelConfig>;
};
type WeaveStickyNoteNodeParams = {
config?: Partial<WeaveStickyNoteProperties>;
};
interface StickyNoteAttributes extends WeaveElementAttributes {
id: string;
nodeType?: string;
x?: number;
y?: number;
width?: number;
height?: number;
color?: string;
dogEarSize?: number;
author?: string;
rotation?: number;
zIndex?: number;
}
Parameters
For WeaveStickyNoteNodeParams:
| Property | Type | Required | Description |
|---|---|---|---|
|
|
Config parameters for the node. |
For WeaveStickyNoteProperties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
|
|
|
Setup the transform properties for the sticky note (anchors, rotation, resize behavior, etc.). |
|
|
|
|
Shape-label rendering and editing engine configuration. |
Node & Label properties
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
|
|
Required |
|
Width of the sticky note in pixels. |
|
|
Required |
|
Height of the sticky note in pixels. |
|
|
|
Background color of the sticky note in hex format. |
|
|
|
|
Size of the bottom-right folded corner in pixels. |
|
|
|
|
Optional author text shown in the bottom-left footer row (rendered as-is). |
|
|
|
Plain text content of the note label. |
||
|
|
|
CSS font-family string for the note label. |
|
|
|
|
Font size of the note label in pixels. |
|
|
|
|
Color of the note label text in hex format. |
|
|
|
|
Horizontal alignment ( |
|
|
|
|
Vertical alignment ( |
|
|
|
|
Line-height multiplier for the note label. |
|
|
|
|
Horizontal inset padding in pixels. |
|
|
|
|
Vertical inset padding in pixels. |
|
|
|
|
Rich-text blocks written by the |
Default values & Constants
The SDK exports the following constants alongside WeaveStickyNoteNode:
-
WEAVE_STICKY_NOTE_NODE_TYPE("sticky-note") -
DEFAULT_STICKY_NOTE_WIDTH(200),DEFAULT_STICKY_NOTE_HEIGHT(200),MIN_STICKY_NOTE_SIZE(120) -
DEFAULT_DOG_EAR_SIZE(28),STICKY_NOTE_AUTHOR_MARGIN(22),DEFAULT_STICKY_NOTE_PADDING(16) -
DEFAULT_STICKY_NOTE_COLOR("#FEF08A") -
STICKY_NOTE_PASTEL_COLORS(8 curated pastel swatches) -
STICKY_NOTE_LABEL_DEFAULTS(WeaveShapeLabelPropsmerged with sticky note typography and top-left padding) -
getStickyNoteVerticalReserve(dogEarSize, hasAuthor, verticalAlign?)(returns the space reserved below the text: the fold and the author line, or only the author line whenverticalAlign === "middle")