Overview
Create a new text element in Figma with specified position, content, and optional styling properties.Parameters
Position & Content
X position of the text element
Y position of the text element
Text content to display
Styling Properties
Font size in pixels. Defaults to 14 if not provided.
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
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 componentg(number, 0-1): Green componentb(number, 0-1): Blue componenta(number, 0-1, optional): Alpha/opacity component
Other Properties
Semantic layer name for the text node. Defaults to “Text” if not provided.
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 elementid(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_contenttool - 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
parentIdis specified - Use the returned
idto modify the text later with tools likeset_text_contentorset_fill_color