Skip to main content

Overview

The set_text_content tool updates the text content of a single text node in Figma. This is useful for making targeted text changes to individual elements.

Parameters

string
required
The ID of the text node to modify
string
required
New text content to set for the node

Response

Returns a success message containing:
  • The name of the updated node
  • The new text content

Example

Use Cases

Update Button Text

Change the label on a button after getting user feedback.

Fix Typos

Correct spelling errors in existing text nodes.

Dynamic Content Updates

Update placeholder text with real data.

Important Notes

Text Node Type

  • Only works on TEXT nodes in Figma
  • Will fail if the specified node is not a text node
  • Preserves all existing text styling (font, size, color, etc.)

Font Loading

  • Figma must have the current font loaded
  • If the font is not available, the operation may fail
  • The plugin automatically attempts to load the font before updating

Text Overflow

  • New text may overflow the text box boundaries
  • Figma’s auto-layout will adjust if the text node is in an auto-layout frame
  • Fixed-size text boxes may clip text that’s too long

Error Handling

Common errors you might encounter:

Performance

  • Single Update: Near-instantaneous for individual text changes
  • Multiple Updates: For updating many nodes, use set_multiple_text_contents instead
  • No Progress Tracking: This tool completes immediately without progress updates

Best Practices

  1. Verify Node Type: Use get_node_info first to confirm the node is a text node
  2. Batch Operations: For multiple updates, use set_multiple_text_contents for better performance
  3. Preserve Formatting: The tool maintains existing character-level formatting within the text
  4. Check Text Length: Consider the text box size before setting long text strings

Workflow Example