Skip to main content

Overview

Create a new text element in Figma with specified position, content, and optional styling properties.

Parameters

Position & Content

number
required
X position of the text element
number
required
Y position of the text element
string
required
Text content to display

Styling Properties

number
Font size in pixels. Defaults to 14 if not provided.
number
Font weight (e.g., 400 for Regular, 700 for Bold). Defaults to 400 if not provided.Common values:
  • 100: Thin
  • 200: Extra Light
  • 300: Light
  • 400: Regular/Normal
  • 500: Medium
  • 600: Semi Bold
  • 700: Bold
  • 800: Extra Bold
  • 900: Black
object
Font color in RGBA format. Defaults to black {r: 0, g: 0, b: 0, a: 1} if not provided.Properties:
  • r (number, 0-1): Red component
  • g (number, 0-1): Green component
  • b (number, 0-1): Blue component
  • a (number, 0-1, optional): Alpha/opacity component

Other Properties

string
Semantic layer name for the text node. Defaults to “Text” if not provided.
string
Optional parent node ID to append the text to. If not provided, the text is created in the current selection or page.

Return Type

Returns an object with:
  • name (string): The name of the created text element
  • id (string): The unique ID of the created text element

Usage Examples

Basic Text

Create simple text with default styling:

Heading Text

Create a large, bold heading:

Colored Text

Create text with a custom color:

Text Inside a Frame

Create text as a child of an existing frame:

Form Label

Create a label for an input field:

Semi-Transparent Helper Text

Create helper text with reduced opacity:

Multi-Element Text Layout

Create a complete text hierarchy:

Notes

  • Text content can be modified later using the set_text_content tool
  • Font color uses RGBA format with values between 0 and 1 (not 0-255)
  • The text element auto-sizes to fit the content by default
  • When placed inside an auto-layout frame, the text will respect the frame’s alignment settings
  • Position coordinates are relative to the parent container if parentId is specified
  • Use the returned id to modify the text later with tools like set_text_content or set_fill_color