BuzzTextField
interface BuzzTextField {
readonly value: string | null
readonly node: TextNode | null
setValueAsync(value: string): Promise<void>
}
Represents a text field within a Buzz media asset that can be dynamically updated. BuzzTextField objects are returned by getTextContent and provide access to both the current text content and the underlying text node.
Properties:
value- The current text content of the field, ornullif the field is emptynode- The underlyingTextNodethat contains this text content, ornullif not found
Methods:
setValueAsync(value)- Updates the text content asynchronously. This method handles the underlying text node updates and maintains formatting where possible.
Usage Example
// Get all text fields from a Buzz asset
const textFields = figma.buzz.getTextContent(selectedNode);
// Update text content
for (const field of textFields) {
await field.setValueAsync('Hello');
}
// Check if text field is empty
if (field.value === null) {
await field.setValueAsync('Default content');
}
BuzzTextField is particularly useful for creating dynamic media templates where text content needs to be updated programmatically based on user input or data sources.