Skip to main content

Elements

Elements are the building blocks placed on the canvas — text, images, SVGs, and their variants. Each element has a type, source, title, and a parameters object that controls its appearance and behavior.

Element Types

TypeSourceDescription
textText contentSingle-line editable text.
textboxText contentMulti-line text with auto-wrap and fixed width.
curved-textText contentText rendered on a circular arc.
neon-textText contentText with a neon glow effect.
engraved-textText contentText with an engraved look (fixed opacity).
imageImage URLRaster image (PNG, JPEG) or SVG. SVGs with multiple paths become CVSVGGroup automatically.

Adding Elements

Via product data

const product = {
views: [{
title: 'Front',
elements: [
{
type: 'text',
source: 'Hello World',
title: 'Greeting',
parameters: {
left: 400, top: 200,
fontSize: 32, fill: '#333',
draggable: true, editable: true,
},
},
],
}],
};

Programmatically

await canvas.addElement('text', 'Hello World', 'Greeting', {
left: 400, top: 200,
fontSize: 32, fill: '#333',
draggable: true, editable: true,
});

await canvas.addElement('image', '/images/logo.png', 'Logo', {
left: 450, top: 300,
scaleX: 0.5, scaleY: 0.5,
});

Base Parameters (ElementParameters)

All element types share these parameters:

Position & Transform

ParameterTypeDefaultDescription
leftnumberX position in canvas pixels.
topnumberY position in canvas pixels.
anglenumber0Rotation in degrees.
scaleXnumber1Horizontal scale factor.
scaleYnumber1Vertical scale factor.
opacitynumber1Opacity (0-1).
flipXbooleanfalseFlip horizontally.
flipYbooleanfalseFlip vertically.
originX'left' | 'center' | 'right''left'Horizontal origin point.
originY'top' | 'center' | 'bottom''top'Vertical origin point.

Permissions

ParameterTypeDefaultDescription
draggablebooleantrueAllow user to drag.
rotatablebooleantrueAllow user to rotate.
resizablebooleantrueAllow user to resize.
removablebooleantrueAllow user to remove.
copyablebooleantrueAllow user to duplicate.
editablebooleantrueAllow user to edit content.
lockedbooleanfalseLock element (must unlock via Manage Layers).
lockUniScalingbooleantrueLock proportional scaling.
uniScalingUnlockablebooleanfalseAllow user to unlock proportional scaling.
minScaleLimitnumber0.01Minimum scale factor.

Colors

ParameterTypeDefaultDescription
fillstring | falseFill color. false = use original.
colorsstring | string[] | falsefalseColor options. '#hex' = color picker, ['#a','#b'] = swatches, false = disabled.
colorLinkGroupstring | falsefalseSync color across elements with the same group name.
colorPricesRecord<string, number>Per-color pricing: { "#ff0000": 5.00 }.

Layering

ParameterTypeDefaultDescription
znumber-1Z-index position. -1 = add on top.
zChangeablebooleantrueAllow user to change z-position.
toppedbooleanfalseAlways keep on top of stack.

Behavior

ParameterTypeDefaultDescription
boundingBoxBoundingBoxValueConstrain element movement.
autoCenterbooleantrueCenter in canvas/bounding box when added.
autoSelectbooleantrueSelect element when added.
replacestringReplace elements with matching replace value.
replaceInAllViewsbooleanfalseReplace in all views, not just current.
fixedbooleanfalseElement persists when product changes.
pricenumber0Price for this element.
skustringSKU identifier for order processing.
excludeFromExportbooleanfalseExclude from SVG/image export.
patternsstring[]Pattern image URLs for fill.
printAreaIdstring | nullAssign to a specific print area.

Shadow

ParameterTypeDefaultDescription
shadowColorstringShadow color.
shadowBlurnumber0Shadow blur radius.
shadowOffsetXnumber0Shadow X offset.
shadowOffsetYnumber0Shadow Y offset.

Text Parameters

Text elements (text, textbox, curved-text, neon-text, engraved-text) accept additional parameters:

ParameterTypeDefaultDescription
fontFamilystring'Arial'Font family name.
fontSizenumber18Font size in pixels.
fontWeightstring'normal'Font weight ('normal', 'bold').
fontStylestring'normal'Font style ('normal', 'italic').
textAlignstring'left'Text alignment.
lineHeightnumber1.16Line height multiplier.
letterSpacingnumber0Additional letter spacing.
textDecorationstring''Text decoration ('underline').
strokestring | nullnullText stroke/outline color.
strokeWidthnumber0Stroke width.
strokeColorsstring[][]Available stroke colors.
maxLengthnumber0Max characters (0 = unlimited).
maxLinesnumber0Max lines (0 = unlimited, textbox only).
minFontSizenumber1Minimum font size.
maxFontSizenumber1000Maximum font size.
textTransformTextTransform'none'Transform: 'none', 'uppercase', 'lowercase'.
curveRadiusnumber100Curve radius (curved-text only).
curveReversebooleanfalseReverse curve direction.
textPlaceholderbooleanfalseNames & Numbers name placeholder.
numberPlaceholderboolean | number[]falseNames & Numbers number placeholder.
textLinkGroupstringSync text content across elements.
widthFontSizenumber0Auto-adjust font size to keep the text at this width; disables manual resizing. Mutually exclusive with heightFontSize.
heightFontSizenumber0Auto-adjust font size to keep the text at this height; disables manual resizing. Mutually exclusive with widthFontSize.

Image Parameters

Image elements accept additional parameters:

ParameterTypeDefaultDescription
filterstring | null | falsenullImage filter: 'grayscale', 'sepia', etc.
colorModeColorBlendModeColor blend mode for tinting.
scaleModeScaleModeHow to scale when fitting: 'fit', 'cover'.
resizeToWnumber | string0Resize to this width.
resizeToHnumber | string0Resize to this height.
uploadZonebooleanfalseUse as clickable upload zone.
svgFillstring | string[] | falsePer-path SVG colors.
imageProxybooleantrueSet false to always render the full-resolution original (opt out of large-image proxying, see below).
proxySourcestringURL of a server-hosted downscaled variant rendered instead of source (hybrid proxy loading, see below). Requires originalWidth/originalHeight.

Large Image Handling

Canvas memory is driven by decoded pixels (width × height × 4 bytes), not file size — a few high-resolution photos can crash mobile browsers. By default, raster images whose natural dimension exceeds the imageProxyMaxDimension option (default 1600, with 25% slack) are downscaled to an in-memory proxy for on-canvas editing:

  • The element's source, logical dimensions, and scaleX/scaleY are unchanged — serialization and orders always reference the full-resolution original.
  • Print exports (server-side and exportPrintAreaToSVG()) render from the original, never the proxy.
  • DPI warnings and the size tooltip rate the original via originalWidth/originalHeight (serialized in the element JSON for proxied images, alongside originalFileSize when known).
  • isProxy is exposed at runtime on the element; it is not serialized.
  • SVGs are never proxied (vector). Raise imageProxyMaxDimension for sharper on-screen zoom at the cost of memory, or set 0 to always render originals.
  • Per-element opt-out: set imageProxy: false on an element to always render its original. Combined with the parameter cascade this also works group-wise — e.g. imageParameters: { imageProxy: false } exempts configured product images while user uploads stay proxied, or customImageParameters: { imageProxy: false } for the reverse.
  • Hybrid (server-side) proxies: when an element carries proxySource plus originalWidth/originalHeight, the canvas loads only that server-hosted variant — the original is never fetched client-side, saving bandwidth on top of memory. The uploads module sets these automatically when the upload server returns image_proxy_src (see the playground's upload-image.php for a reference), and Pixabay picks use Pixabay's own webformatURL as variant for high-res images. proxySource is serialized, so restored designs keep skipping the original; if the variant fails to load, the original loads with client-side proxying as fallback. Orders and exports are identical in both modes: source always stays the full-resolution original.

For the full picture — both proxying modes, configuration, per-group opt-out, the upload server contract, and automatic wiring — see the Image Proxy Loading guide.

Custom Parameters

When users add their own text or images (via the UI modules), you can constrain what they're allowed to do using customTextParameters and customImageParameters in options:

const options = {
customTextParameters: {
maxLength: 50,
minFontSize: 12,
maxFontSize: 72,
colors: ['#000000', '#ffffff', '#ff0000'],
draggable: true,
resizable: true,
removable: true,
},
customImageParameters: {
draggable: true,
resizable: true,
removable: true,
minW: 100, // Min upload width (px)
minH: 100, // Min upload height (px)
maxSize: 10, // Max file size (MB)
minDPI: 150, // Min DPI for quality
},
};

Parameter Cascade

Parameters merge in this order (each level overrides the previous):

elementParameters → textParameters → customTextParameters
elementParameters → imageParameters → customImageParameters

And options cascade through:

OPTION_DEFAULTS → mainOptions → viewOptions → printAreaProfile

See Options Cascade for details.

Next Steps