Web2PrintTextAttributeController
You get this controller when useAttribute(...) resolves a Web2Print text attribute. A text attribute holds a free-input string plus formatting (font, color, offsets, rotation, scale) that the shopper edits to personalize a print.
import { useAttribute } from "@expivi/product-configurator";
const attribute = useAttribute(configurator, attributeCid);
Editing text and formatting
Set the text content, then adjust individual formatting properties. When no configured value exists yet, the controller seeds one from the text-print defaults.
attribute.setTextValue("Happy Birthday");
attribute.setTextProperty("font", "Georgia");
attribute.setTextProperty("color", "#ff0000");
attribute.setTextProperty("rotation", 15);
// Populate a color picker from configured palettes
const colors = await attribute.getPaletteColors();
API
setTextValue(value: string): void
Sets the text content. Convenience wrapper around setValue(value).
setTextProperty(property, value): void
Updates one non-text property on the configured text value while keeping the current text. Supported properties include font, color, offsetX, offsetY, rotation, and scale.
attribute.setTextProperty("offsetX", 12);
getPaletteColors(): Promise<PaletteColor[]>
Loads the colors from every palette referenced by the text attribute's color_palettes settings. Returns an empty array when no palettes are configured.
Serialization emits the text string plus a data block with font, scale, offsets, rotation, and color. For all other members, see the Common Attribute API.